Given an array of positive integers `nums`, return the **maximum** possible sum of an **ascending** subarray in `nums`. A subarray is ascending if each element is strictly greater than the element before it. Note that a subarray of size 1 is ascending.
Given an array of positive integers nums, return the maximum possible sum of an ascending subarray in nums. A subarray is ascending if each element is strictly greater than the element before it. Note that a subarray of size 1 is ascending.
Example 1:
Input: {"nums":[10,20,30,5,10,50]}
Output: 65
Constraints:
1≤nums.length≤100
1≤nums[i]≤100
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"nums":[10,20,30,5,10,50]}
Find the climbing runs: stretches where every bar is taller than the one before. All values are positive, so a whole run always beats any part of it.
bars = nums; a red cut marks where the climb stops (nums[i] ≤ nums[i-1])