Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Excerpt

Given an array A of integers, a ramp is a tuple (i, j) for which i < j and A[i] <= A[j]. The width of such a ramp is j - i.

...

 Find the maximum width of a ramp in A. If one doesn't exist, return 0.



Example 1:

Code Block
Input: [6,0,8,2,1,5]
Output: 4

...