This commit is contained in:
parent
14772aa21f
commit
b402cce21a
1 changed files with 12 additions and 0 deletions
12
easy/find_the_highest_altitude.py
Normal file
12
easy/find_the_highest_altitude.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# https://leetcode.com/problems/find-the-highest-altitude
|
||||
|
||||
from typing import List
|
||||
|
||||
class Solution:
|
||||
def largestAltitude(self, gain: List[int]) -> int:
|
||||
result = 0
|
||||
current = 0
|
||||
for altitude in gain:
|
||||
current += altitude
|
||||
result = max(current, result)
|
||||
return result
|
||||
Loading…
Add table
Add a link
Reference in a new issue