Highest Route Point
A biker starts at altitude 0, and each segment of the route changes the altitude up or down. Given a list gain, where gain[i] is the altitude change on the next segment, calculate the altitude after each segment. Return the highest altitude reached during the route.
Примеры
Ввод
[-5, 1, 5, 0, -7]Вывод
1Ввод
[-4, -3, -2, -1, 4, 3, 2]Вывод
0Ввод
[1, 2, 3]Вывод
6Нужно реализовать
def largest_altitude(gain: list[int]) -> int:
Теги
arraymath
Log ind for at se indsendelseshistorik
Log indLog ind for at bruge AI-mentor
Log indVisible tests
1
Input
[-5,1,5,0,-7]Expected
12
Input
[-4,-3,-2,-1,4,3,2]Expected
03
Input
[1,2,3]Expected
64
Input
[]Expected
05
Input
[44,32,-9,52,23,-39,-55,-30,-20,4]Expected
1426
Input
[1,2,3,1,2]Expected
9Focus radio
Paused · SomaFM · Fluid