Find two positions i < j such that nums[i] <= nums[j]. Return the largest possible distance j - i, or 0 if no pair satisfies the condition.
Example 1:
Input: nums = [4,1,2,3]
Output: 2Explanation: Choose indices 1 and 3: the values satisfy 1 <= 3 and the width is 3 - 1 = 2. Index 0 cannot start a wider ramp because its value exceeds every later value.
Example 2:
Input: nums = [4,3,2,1]
Output: 0Explanation: The values strictly decrease, so no earlier entry is less than or equal to a later entry. There is no ramp.
Example 3:
Input: nums = [2,2]
Output: 1Explanation: The equal values at indices 0 and 1 satisfy the condition, giving width 1.
Constraints:
2 <= nums.length <= 500000 <= nums[i] <= 50000