def backPack(self, m, A):
        n = len(A)
        f = [[0 for _ in xrange(m+1)] for _ in xrange(n+1)]  # plus 1 for dummy
        for i in xrange(1, n+1):
            for j in xrange(1, m+1):
                # decide whether to put A[i-1]
                if j-A[i-1] >= 0:
                    f[i][j] = max(f[i-1][j], f[i-1][j-A[i-1]]+A[i-1])
                else:
                    f[i][j] = f[i-1][j]
        return f[n][m]
dp
dataset/ETHPy150Open algorhythms/LintCode/Backpack.py/Solution_MLE.backPack