Simple Take - NotTake DP || Easy to Understand || Beats 100% || C++
Complexity\n- Time complexity:O(n * n * k)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(n * n * k)\n Add your space complexity here, e.g.
# Complexity\n- Time complexity:$$O(n * n * k)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(n * n * k)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int mod = 1e9 + 7;\n    long long ans = 0;\n    long long binpow(long long a, long long b, long long m) {\n        a %= m;\n        long long res = 1;\n        while (b > 0) {\n            if (b & 1)\n                res = res * a % m;\n            a = a * a % m;\n            b >>= 1;\n        }\n        return res;\n    }\n    int dp[110][110][110];\n    int solve(int i, int n, int k, int len, vector<int>& nums){\n        if(i == n){\n            if(k == 0){\n                return binpow(2, len, mod);\n            }\n            return 0;\n        }\n        if(dp[i][k][len] != -1) return dp[i][k][len];\n        int nottake = solve(i+1, n, k, len + 1, nums);\n        int take = 0;\n        if(nums[i] <= k) take = solve(i+1, n, k - nums[i], len, nums);\n        return dp[i][k][len] = (take + nottake) % mod;\n    }\n    int sumOfPower(vector<int>& nums, int k) {\n        memset(dp, -1, sizeof dp);\n        int n = nums.size();\n        return solve(0, n, k, 0, nums);\n    }\n};\n```
['C++']