⚡DP || 🔥Memoization || 💯2 ^ (n -count)⚡
\n\n# Complexity\n\n- Time complexity:\nO(n ^ 3)\n\n- Space complexity:\nO(n ^ 3)\n\n\n# Code\n## Please Upvote if it helps\uD83E\uDD17\n\nclass Solution {\npub
\n\n# Complexity\n```\n- Time complexity:\nO(n ^ 3)\n\n- Space complexity:\nO(n ^ 3)\n```\n\n# Code\n## Please Upvote if it helps\uD83E\uDD17\n```\nclass Solution {\npublic:\n    int mod = 1e9 + 7, n;\n    int dp[101][101][101];\n    int func(int x){\n        int ans = 1;\n        while(x--)\n            ans = (ans * 2) % mod;\n        return ans;\n    }\n    int helper(int ind, vector<int>& nums, int curr_sum, int count, int k){\n        if(curr_sum > k)\n            return 0;\n        if(curr_sum == k)\n            return func(n - count);\n        if(ind == n)\n            return 0;\n        if(dp[ind][curr_sum][count] != -1)\n            return dp[ind][curr_sum][count];\n        int cnt = 0;\n        cnt = (cnt + helper(ind + 1, nums, curr_sum + nums[ind], count + 1, k)) % mod;\n        cnt = (cnt + helper(ind + 1, nums, curr_sum, count, k)) % mod;\n        return dp[ind][curr_sum][count] = cnt;\n    }\n\n    int sumOfPower(vector<int>& nums, int k) {\n        n = nums.size();\n        memset(dp, -1, sizeof(dp));\n        return helper(0, nums, 0, 0, k);\n    }\n};\n```
['Dynamic Programming', 'Memoization', 'C++']