class Solution(object):
def findMaxForm(self, strs, m, n):
dp = [[0]*(n+1) for _ in xrange(m+1)]
for s in strs:
z,o = s.count('0'),s.count('1')
for i in xrange(m,1,1):
for j in xrange(n,1,1):
if z <= i and o <= j:
dp[i][j] = max(dp[i][j],1+dp[iz][jo])
return dp[m][n]
Short Python DP

@StefanPochmann oh right, rookie mistake :P i moved calc for
z,o
up for chain. thx for pointing it out