gains lists the positive elevation gains of consecutive trail segments. A climb is a contiguous block of segments whose gains are strictly increasing. The steepness of a climb is the sum of its gains. Return the largest steepness of any climb in the list.
Examples
Input: gains = [6, 14, 30, 4, 9, 13, 40]
Output: 66
Explanation: 4, 9, 13, 40 is a climb worth 66, more than 6, 14, 30 (50).
Input: gains = [20, 25, 18, 14, 9, 16, 22]
Output: 47
Explanation: 9, 16, 22 sums to 47, just beating 20, 25 (45).
Constraints
1 <= len(gains) <= 10**51 <= gains[i] <= 100- Target: O(n) time, O(1) extra space.
Goals
- Accumulate a sum over a strictly increasing run
- Restart the accumulation when the run breaks