My Solution
\n/**\n * Time Complexity: O(n * k)\n * Space Complexity: O(k)\n * where `n` is the length of the vector `nums`\n */\nclass Solution {\n public:\n  int sumOfPow
```\n/**\n * Time Complexity: O(n * k)\n * Space Complexity: O(k)\n * where `n` is the length of the vector `nums`\n */\nclass Solution {\n public:\n  int sumOfPower(vector<int> &nums, const int k) {\n    constexpr int mod = 1000000007;\n    const int n = static_cast<int>(nums.size());\n    int dp[k + 1];\n    memset(dp, 0, sizeof(dp));\n    dp[0] = 1;\n    for (const int num : nums) {\n      for (int sum = k; sum > -1; --sum) {\n        dp[sum] = (dp[sum] << 1) % mod;\n        if (sum >= num) {\n          dp[sum] = (dp[sum] + dp[sum - num]) % mod;\n        }\n      }\n    }\n    return dp[k];\n  }\n};\n```
[]