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_0 , int var_1 , int var_2 ) {
    if ( var_0 == null || var_0 . length == 0 || ( var_1 == 0 && var_2 == 0 ) ) {
      return 0 ;
    }
    int var_3 = var_0 . length ;
    int [ ] [ ] [ ] var_4 = new int [ var_1 + 1 ] [ var_2 + 1 ] [ 2 ] ;
    int var_5 = 1 ;
    int var_6 = 0 ;
    int [ ] var_7 = new int [ var_3 ] ;
    int [ ] var_8 = new int [ var_3 ] ;
    for ( int var_9 = 0 ;
    var_9 < var_3 ;
    var_9 ++ ) {
      char [ ] var_10 = var_0 [ var_9 ] . toCharArray ( ) ;
      for ( char var_11 : var_10 ) {
        var_7 [ var_9 ] += var_11 == '1' ? 1 : 0 ;
        var_8 [ var_9 ] += var_11 == '0' ? 1 : 0 ;
      }
    }
    for ( int var_9 = 0 ;
    var_9 <= var_3 ;
    var_9 ++ ) {
      var_6 = var_5 ;
      var_5 = 1 - var_6 ;
      for ( int var_12 = 0 ;
      var_12 <= var_1 ;
      var_12 ++ ) {
        for ( int var_13 = 0 ;
        var_13 <= var_2 ;
        var_13 ++ ) {
          if ( var_9 == 0 || ( var_12 == 0 && var_13 == 0 ) ) {
            var_4 [ var_12 ] [ var_13 ] [ var_5 ] = 0 ;
            continue ;
          }
          var_4 [ var_12 ] [ var_13 ] [ var_5 ] = var_4 [ var_12 ] [ var_13 ] [ var_6 ] ;
          int var_14 = var_8 [ var_9 - 1 ] ;
          int var_15 = var_7 [ var_9 - 1 ] ;
          if ( var_12 >= var_14 && var_13 >= var_15 ) {
            var_4 [ var_12 ] [ var_13 ] [ var_5 ] = Math . max ( var_4 [ var_12 ] [ var_13 ] [ var_5 ] , var_4 [ var_12 - var_14 ] [ var_13 - var_15 ] [ var_6 ] + 1 ) ;
          }
        }
      }
    }
    return var_4 [ var_1 ] [ var_2 ] [ var_5 ] ;
  }
  