Return an array result of the same length, where result[i] is the number of indices you have to move forward from index i to reach a strictly greater value. If no later index holds a strictly greater value, set result[i] = 0.
Examples
Example 1
Input: nums = [73,74,75,71,69,72,76,73]
Output: [1,1,4,2,1,1,0,0]
Explanation: The value 75 at index 2 is first exceeded four indices later, at index 6 (value 76). Nothing after index 6 or index 7 is greater, so both are 0.
Example 2
Input: nums = [30,40,50,60]
Output: [1,1,1,0]
Example 3
Input: nums = [30,60,90]
Output: [1,1,0]
Constraints
1≤nums.length≤105
30≤nums[i]≤100
Loading editor...
Log in to run your code. Your draft is saved in this browser.Log inSign up