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 no ramp exists, return 0.
Input: Integer array nums.
Output: Integer — maximum width of any ramp, or 0.
Input: [6,0,8,2,1,5]
Output: 4
Explanation: Ramp (1,5): nums[1]=0<=nums[5]=5. Width=4.Input: [9,8,1,0,1,9,4,0,4,1]
Output: 7
Explanation: Ramp (2,9): nums[2]=1<=nums[9]=1. Width=7.Input: [1,2,3,4,5]
Output: 4
Explanation: Ramp (0,4): 1<=5. Width=4.2<=nums.length<=5*10^40<=nums[i]<=5*10^4