Find the Highest Altitude
Easy
Topics
A biker starts at altitude 0. gain[i] is the net gain between point i and i+1. Return the highest altitude reached.
Example 1
Input: gain = [-5,1,5,0,-7] Output: 1
Example 2
Input: gain = [-4,-3,-2,-1,4,3,2] Output: 0
Constraints
- 1 <= gain.length <= 100
- -100 <= gain[i] <= 100
Run ⌘' · Submit ⌘⏎