comefrom: <qiyuangong>962_Maximum_Width_Ramp_2.java
code: public int maxWidthRamp(int[] A) {
          int N = A.length;
  
          int ans = 0;
          List<Point> candidates = new ArrayList();
          candidates.add(new Point(A[N-1], N-1));
  
          for (int i = N-2; i >= 0; --i) {
              int lo = 0, hi = candidates.size();
              while (lo < hi) {
                  int mi = lo + (hi - lo) / 2;
                  if (candidates.get(mi).x < A[i])
                      lo = mi + 1;
                  else
                      hi = mi;
              }
              if (lo < candidates.size()) {
                  int j = candidates.get(lo).y;
                  ans = Math.max(ans, j - i);
              } else {
                  candidates.add(new Point(A[i], i));
              }
          }
          return ans;
      }
masked: public int sample_funcname ( int [ ] A ) {
    int N = A . length ;
    int ans = 0 ;
    List < Point > candidates = new ArrayList ( ) ;
    candidates . add ( new Point ( A [ N - 1 ] , N - 1 ) ) ;
    for ( int i = N - 2 ;
    i >= 0 ;
    -- i ) {
      int lo = 0 , hi = candidates . size ( ) ;
      while ( lo < hi ) {
        int mi = lo + ( hi - lo ) / 2 ;
        if ( candidates . get ( mi ) . x < A [ i ] ) lo = mi + 1 ;
        else hi = mi ;
      }
      if ( lo < candidates . size ( ) ) {
        int j = candidates . get ( lo ) . y ;
        ans = Math . max ( ans , j - i ) ;
      }
      else {
        candidates . add ( new Point ( A [ i ] , i ) ) ;
      }
    }
    return ans ;
  }
  