dp py3
it doesn\'t look very smart and you have to do the manual tabulation or it would result in mle\n\n# Code\n\nclass Solution:\n    def sumOfPower(self, nums: List
it doesn\'t look very smart and you have to do the manual tabulation or it would result in mle\n\n# Code\n```\nclass Solution:\n    def sumOfPower(self, nums: List[int], k: int) -> int:\n        n = len(nums)\n        prevdp = [[0 for s in range(k+1)] for j in range(n+1)]\n        prevdp[0][0] = 1\n        for i in range(1,n+1):\n            dp = [[0 for s in range(k+1)] for j in range(n+1)]\n            dp[0][0] = 1\n            for j in range(1,n+1):\n                for s in range(k+1):\n                    dp[j][s] += prevdp[j][s]\n                    if s - nums[i-1] >=0:\n                        dp[j][s] += prevdp[j-1][s-nums[i-1]]\n            prevdp = dp\n        res = 0\n        for j in range(1,n+1):\n            res += 2**(n-j) * dp[j][k] %  (10**9+7)\n        return res % (10**9+7)\n\n        \n```
['Python3']