Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int combinationSum4(vector<int>& nums, int target) {
- vector<int> memo(target + 1);
- memo[0] = 1;
- for (int s = 1; s < memo.size(); ++s) {
- for (auto x : nums) {
- if (s - x >= 0) memo[s] += memo[s - x];
- }
- }
- return memo.back();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement