A ramp in an integer array nums is a pair (i, j) where i < j and nums[i] <= nums[j]. The width of such a ramp is j - i. Return the maximum width of a ramp in nums. If there is no ramp, return 0.
Example 1:
Input: 6 0 8 2 1 5 Output: 4 Explanation: (1, 5): nums[1]=0 ≤ nums[5]=5, width = 4.
Example 2:
Input: 9 8 1 0 1 9 4 0 4 1 Output: 7
Constraints:
- 2 ≤ nums.length ≤ 5 × 10⁴
- 0 ≤ nums[i] ≤ 5 × 10⁴
Input format: One line — space-separated integers.
Output format: Maximum ramp width.