Find all possible combinations of _ k _ numbers that add up to a number _ n _, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.
Ensure that numbers within the set are sorted in ascending order.
_ Example 1: _
Input: _ k _ = 3, _ n _ = 7
Output:
[[1,2,4]]
_ Example 2: _
Input: _ k _ = 3, _ n _ = 9
Output:
[[1,2,6], [1,3,5], [2,3,4]]
Credits:
Special thanks to @mithmatt for adding this problem and creating all test cases.
Show Tags Array Backtracking
Show Similar Problems (M) Combination Sum