comefrom: <awangdev>221. Maximal Square_3.java
code: public int maximalSquare(char[][] matrix) {
          if (matrix == null || matrix.length == 0 || matrix[0] == null || matrix[0].length == 0) {
              return 0;
          }
          int m = matrix.length;
          int n = matrix[0].length;
          int[][] dp = new int[2][n];
          int maxLen = 0;
          int curr = 0;
          int prev = 0;
  
          for (int i = 0; i < m; i++) {
              curr = prev;
              prev = 1 - curr;
              for (int j = 0; j < n; j++) {
                  if (i == 0 || j == 0) {
                      dp[curr][j] = matrix[i][j] == '1' ? 1 : 0;
                      maxLen = Math.max(dp[curr][j], maxLen);
                      continue;
                  }
                  if (matrix[i][j] == '1') {
                      dp[curr][j] = Math.min(Math.min(dp[prev][j], dp[curr][j - 1]), dp[prev][j - 1]) + 1;
                  } else {
                      dp[curr][j] = 0;
                  }
                  maxLen = Math.max(dp[curr][j], maxLen);
              }
          }
          return maxLen * maxLen;
      }
masked: public int sample_funcname ( char [ ] [ ] var_0 ) {
    if ( var_0 == null || var_0 . length == 0 || var_0 [ 0 ] == null || var_0 [ 0 ] . length == 0 ) {
      return 0 ;
    }
    int var_4 = var_0 . length ;
    int var_5 = var_0 [ 0 ] . length ;
    int [ ] [ ] var_7 = new int [ 2 ] [ var_5 ] ;
    int var_8 = 0 ;
    int var_9 = 0 ;
    int var_10 = 0 ;
    for ( int var_11 = 0 ;
    var_11 < var_4 ;
    var_11 ++ ) {
      var_9 = var_10 ;
      var_10 = 1 - var_9 ;
      for ( int var_13 = 0 ;
      var_13 < var_5 ;
      var_13 ++ ) {
        if ( var_11 == 0 || var_13 == 0 ) {
          var_7 [ var_9 ] [ var_13 ] = var_0 [ var_11 ] [ var_13 ] == '1' ? 1 : 0 ;
          var_8 = Math . max ( var_7 [ var_9 ] [ var_13 ] , var_8 ) ;
          continue ;
        }
        if ( var_0 [ var_11 ] [ var_13 ] == '1' ) {
          var_7 [ var_9 ] [ var_13 ] = Math . min ( Math . min ( var_7 [ var_10 ] [ var_13 ] , var_7 [ var_9 ] [ var_13 - 1 ] ) , var_7 [ var_10 ] [ var_13 - 1 ] ) + 1 ;
        }
        else {
          var_7 [ var_9 ] [ var_13 ] = 0 ;
        }
        var_8 = Math . max ( var_7 [ var_9 ] [ var_13 ] , var_8 ) ;
      }
    }
    return var_8 * var_8 ;
  }
  