comefrom: <awangdev>Ones and Zeroes_2.java
code: public int findMaxForm(String[] strs, int m, int n) {
          if (strs == null || strs.length == 0 || (m == 0 && n == 0)) {
              return 0;
          }
          int len = strs.length;
          int[][][] dp = new int[m + 1][n + 1][2];
          int curr = 1;
          int prev = 0;
          
          int[] ones = new int[len];
          int[] zeros = new int[len];
          for (int k = 0; k < len; k++) {
              char[] ss = strs[k].toCharArray();
              for (char c : ss) {
                  ones[k] += c == '1' ? 1 : 0;
                  zeros[k] += c == '0' ? 1 : 0;
              }
          }
          for (int k = 0; k <= len; k++) {
              prev = curr;
              curr = 1 - prev;
              for (int i = 0; i <= m; i++) {
                  for (int j = 0; j <= n; j++) {
                      if (k == 0 || (i == 0 && j == 0)) {
                          dp[i][j][curr] = 0;
                          continue;
                      }
                      dp[i][j][curr] = dp[i][j][prev]; 
                      int countZero = zeros[k - 1];
                      int countOne = ones[k - 1];
                      if (i >= countZero && j >= countOne) {
                          dp[i][j][curr] = Math.max(dp[i][j][curr], dp[i - countZero][j - countOne][prev] + 1);
                      }
                  }
              }
          }
          return dp[m][n][curr];
      }
masked: public int sample_funcname ( String [ ] var_1 , int var_2 , int var_3 ) {
    if ( var_1 == null || var_1 . length == 0 || ( var_2 == 0 && var_3 == 0 ) ) {
      return 0 ;
    }
    int var_7 = var_1 . length ;
    int [ ] [ ] [ ] var_10 = new int [ var_2 + 1 ] [ var_3 + 1 ] [ 2 ] ;
    int var_11 = 1 ;
    int var_12 = 0 ;
    int [ ] var_13 = new int [ var_7 ] ;
    int [ ] var_14 = new int [ var_7 ] ;
    for ( int var_15 = 0 ;
    var_15 < var_7 ;
    var_15 ++ ) {
      char [ ] var_17 = var_1 [ var_15 ] . toCharArray ( ) ;
      for ( char var_18 : var_17 ) {
        var_13 [ var_15 ] += var_18 == '1' ? 1 : 0 ;
        var_14 [ var_15 ] += var_18 == '0' ? 1 : 0 ;
      }
    }
    for ( int var_15 = 0 ;
    var_15 <= var_7 ;
    var_15 ++ ) {
      var_12 = var_11 ;
      var_11 = 1 - var_12 ;
      for ( int var_21 = 0 ;
      var_21 <= var_2 ;
      var_21 ++ ) {
        for ( int var_22 = 0 ;
        var_22 <= var_3 ;
        var_22 ++ ) {
          if ( var_15 == 0 || ( var_21 == 0 && var_22 == 0 ) ) {
            var_10 [ var_21 ] [ var_22 ] [ var_11 ] = 0 ;
            continue ;
          }
          var_10 [ var_21 ] [ var_22 ] [ var_11 ] = var_10 [ var_21 ] [ var_22 ] [ var_12 ] ;
          int var_23 = var_14 [ var_15 - 1 ] ;
          int var_24 = var_13 [ var_15 - 1 ] ;
          if ( var_21 >= var_23 && var_22 >= var_24 ) {
            var_10 [ var_21 ] [ var_22 ] [ var_11 ] = Math . max ( var_10 [ var_21 ] [ var_22 ] [ var_11 ] , var_10 [ var_21 - var_23 ] [ var_22 - var_24 ] [ var_12 ] + 1 ) ;
          }
        }
      }
    }
    return var_10 [ var_2 ] [ var_3 ] [ var_11 ] ;
  }
  