Combination Sum III
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.
(从1-9中选取k个数的和为n)
Note:
- All numbers will be positive integers.
- The solution set must not contain duplicate combinations.
Example:
1. 回溯法
1 | class Solution: |