ZhongKuo0228 / study

0 stars 0 forks source link

1732. Find the Highest Altitude #76

Open fockspaces opened 1 year ago

fockspaces commented 1 year ago
  1. cur_state
  2. 迭代 & 更新
class Solution:
    def largestAltitude(self, gain: List[int]) -> int:
        highest = cur_height = 0
        for g in gain:
            cur_height += g
            highest = max(highest, cur_height)
        return highest