Dynamic Programming: Knapsack - Ones and Zeroes (2D Knapsack)
Examine the following code snippet attempting to solve the Ones and Zeroes problem. Identify the subtle bug that causes incorrect results on some inputs.
```python
def findMaxForm(strs, m, n):
dp = [[0] * (n + 1) for _ in range(m + 1)]
for s in strs:
zeros = s.count('0')
ones = len(s) - zeros
for i in range(zeros, m + 1): # Forward iteration
for j in range(ones, n + 1): # Forward iteration
dp[i][j] = max(dp[i][j], 1 + dp[i - zeros][j - ones])
return dp[m][n]
```
