Ones and Zeroes
You are given an array of binary strings strs and two integers m and n. Return the size of the largest subset of strs such that there are at most m 0's and n 1's in the subset.
Ones and Zeroes

You are given an array of binary strings strs and two integers m and n. Return the size of the largest subset of strs such that there are at most m 0's and n 1's in the subset.

Example 1:
Input: {"strs":["10","0001","111001","1","0"],"m":5,"n":3}
Output: 4
Input
arr ={"strs":["10","0001","111001","1","0"],"m":5,"n":3}

Initialize DP table (6 × 4). Find max subset with ≤5 zeros and ≤3 ones.

Strings (max 5 zeros, 3 ones)
10
0001
111001
1
0
DP Table: dp[i][j] = max strings with i zeros, j ones
0
1
2
3
0
0
0
0
0
1
0
0
0
0
2
0
0
0
0
3
0
0
0
0
4
0
0
0
0
5
0
0
0
0
Variables
No variables to display
DepthFunction Call
Stack empty
0/11