Multiset Sum
Given a list of unique positive integers nums
and a positive integer k
, return the number of unique combinations that sum up to k
. You may reuse numbers when creating combinations.
Constraints
n ≤ 25
wheren
is the length ofnums
1 ≤ nums[i] ≤ 250
for all0 ≤ i < n
1 ≤ k ≤ 500
https://binarysearch.com/problems/Multiset-Sum
Examples
Example 1
Input
- nums =
[1, 2, 3]
- k =
2
Output
- answer =
2
Explanation
We can make 2
with [1, 1]
and [2]
.
Leave a comment