<awangdev>Russian Doll Envelopes_2.java
public int maxEnvelopes(int[][] envelopes) {
        if (envelopes == null || envelopes.length == 0 
           || envelopes[0] == null || envelopes[0].length == 0) {
            return 0;
        }
        int n = 0, m = 0;
        for (int[] envelope : envelopes) {
            n = Math.max(n, envelope[0]);
            m = Math.max(m, envelope[1]);
        }
        int[][] dp = new int[n + 1][m + 1];
        for (int[] envelope : envelopes) {
            dp[envelope[0]][envelope[1]] = 1;
        }
        
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                int temp = dp[i][j] == 1 ? dp[i - 1][j - 1] + dp[i][j] : Math.max(dp[i - 1][j], dp[i][j - 1]);
                dp[i][j] = Math.max(temp, dp[i][j]);
            }
        }
        return dp[n][m];
    }
public int sample_funcname ( int [ ] [ ] var_0 ) {
  if ( var_0 == null || var_0 . length == 0 || var_0 [ 0 ] == null || var_0 [ 0 ] . length == 0 ) {
    return 0 ;
  }
  int var_4 = 0 , var_5 = 0 ;
  for ( int [ ] var_6 : var_0 ) {
    var_4 = Math . max ( var_4 , var_6 [ 0 ] ) ;
    var_5 = Math . max ( var_5 , var_6 [ 1 ] ) ;
  }
  int [ ] [ ] var_10 = new int [ var_4 + 1 ] [ var_5 + 1 ] ;
  for ( int [ ] var_6 : var_0 ) {
    var_10 [ var_6 [ 0 ] ] [ var_6 [ 1 ] ] = 1 ;
  }
  for ( int var_11 = 1 ;
  var_11 <= var_4 ;
  var_11 ++ ) {
    for ( int var_12 = 1 ;
    var_12 <= var_5 ;
    var_12 ++ ) {
      int var_13 = var_10 [ var_11 ] [ var_12 ] == 1 ? var_10 [ var_11 - 1 ] [ var_12 - 1 ] + var_10 [ var_11 ] [ var_12 ] : Math . max ( var_10 [ var_11 - 1 ] [ var_12 ] , var_10 [ var_11 ] [ var_12 - 1 ] ) ;
      var_10 [ var_11 ] [ var_12 ] = Math . max ( var_13 , var_10 [ var_11 ] [ var_12 ] ) ;
    }
  }
  return var_10 [ var_4 ] [ var_5 ] ;
}
