<awangdev>Ones and Zeroes_1.java
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][len + 1];
        
        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 i = 0; i <= m; i++) {
            for (int j = 0; j <= n; j++) {
                for (int k = 0; k <= len; k++) {
                    if (k == 0 || (i == 0 && j == 0)) {
                        dp[i][j][k] = 0;
                        continue;
                    }
                    dp[i][j][k] = dp[i][j][k - 1]; 
                    int countZero = zeros[k - 1];
                    int countOne = ones[k - 1];
                    if (i >= countZero && j >= countOne) {
                        dp[i][j][k] = Math.max(dp[i][j][k], dp[i - countZero][j - countOne][k - 1] + 1);
                    }
                }
            }
        }
        return dp[m][n][len];
    }
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_9 = new int [ var_2 + 1 ] [ var_3 + 1 ] [ var_7 + 1 ] ;
  int [ ] var_10 = new int [ var_7 ] ;
  int [ ] var_11 = new int [ var_7 ] ;
  for ( int var_12 = 0 ;
  var_12 < var_7 ;
  var_12 ++ ) {
    char [ ] var_14 = var_1 [ var_12 ] . toCharArray ( ) ;
    for ( char var_15 : var_14 ) {
      var_10 [ var_12 ] += var_15 == '1' ? 1 : 0 ;
      var_11 [ var_12 ] += var_15 == '0' ? 1 : 0 ;
    }
  }
  for ( int var_18 = 0 ;
  var_18 <= var_2 ;
  var_18 ++ ) {
    for ( int var_19 = 0 ;
    var_19 <= var_3 ;
    var_19 ++ ) {
      for ( int var_12 = 0 ;
      var_12 <= var_7 ;
      var_12 ++ ) {
        if ( var_12 == 0 || ( var_18 == 0 && var_19 == 0 ) ) {
          var_9 [ var_18 ] [ var_19 ] [ var_12 ] = 0 ;
          continue ;
        }
        var_9 [ var_18 ] [ var_19 ] [ var_12 ] = var_9 [ var_18 ] [ var_19 ] [ var_12 - 1 ] ;
        int var_20 = var_11 [ var_12 - 1 ] ;
        int var_21 = var_10 [ var_12 - 1 ] ;
        if ( var_18 >= var_20 && var_19 >= var_21 ) {
          var_9 [ var_18 ] [ var_19 ] [ var_12 ] = Math . max ( var_9 [ var_18 ] [ var_19 ] [ var_12 ] , var_9 [ var_18 - var_20 ] [ var_19 - var_21 ] [ var_12 - 1 ] + 1 ) ;
        }
      }
    }
  }
  return var_9 [ var_2 ] [ var_3 ] [ var_7 ] ;
}
