Loading...
You are given an integer array nums.
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.
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.
Input: nums = [30,40,50,60]
Output: [1,1,1,0]
Input: nums = [30,60,90]
Output: [1,1,0]
nums.length ≤105nums[i] ≤100Click "Run" to test with sample cases or "Submit" to run all tests.