package leetcode;

/**
 * https://leetcode.com/problems/maximum-width-ramp/
 */
public class Problem962 {
    public int maxWidthRamp(int[] A) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem962 prob = new Problem962();
        System.out.println(prob.maxWidthRamp(new int[]{6, 0, 8, 2, 1, 5})); // 4
        System.out.println(prob.maxWidthRamp(new int[]{9, 8, 1, 0, 1, 9, 4, 0, 4, 1})); // 7
    }
}

@@ -150,15 +150,272 @@
     
-// TODO
+int max = 0;%0A        for (int i = 0; i %3C A.length; i++) %7B%0A            for (int j = A.length - 1; j %3E= i; j--) %7B%0A                if (A%5Bi%5D %3C= A%5Bj%5D) %7B%0A                    max = Math.max(max, j - i);%0A                    break;%0A                %7D%0A            %7D%0A        %7D
 %0A   
@@ -426,17 +426,19 @@
  return 
-0
+max
 ;%0A    %7D%0A
@@ -608,16 +608,16 @@
 ); // 4%0A
-
         
@@ -701,16 +701,94 @@
 ); // 7%0A
+        System.out.println(prob.maxWidthRamp(new int%5B%5D%7B5, 4, 3, 2, 1%7D)); // 0%0A
     %7D%0A%7D%0A

Update problem 962