```
def findMaxForm(self, strs, m, n):
"""
:type strs: List[str]
:type m: int
:type n: int
:rtype: int
"""
dp = [[0] * (n + 1) for _ in range(m + 1)]
for s in strs:
x, y = s.count('0'), s.count('1')
for i in range(m, x - 1, -1):
for j in range(n, y - 1, -1):
dp[i][j] = max(dp[i][j], 1 + dp[i - x][j - y])
return dp[m][n]
```