Maximum Width Ramp
Medium · Stack & Monotonic Stack · about 20 minutes
Asked at Google, Amazon, ByteDance, Microsoft, Bloomberg.
A ramp is a pair i < j with nums[i] <= nums[j]; its width is j - i. Return the maximum width of a ramp, or 0 if there is none.