public List<List<Integer>> combinationSum3(int k, int n) {
List<List<Integer>> res = new ArrayList<>();
List<Integer> combinations = new ArrayList<>();
getCombinations(1, 0, k, n, combinations, res);
public void getCombinations(int start, int sum, int k, int target, List<Integer> combinations, List<List<Integer>> res) {
if (k == 0 && sum == target) {
res.add(new ArrayList<>(combinations));
for (int i = start; i <= 9; i++) {
getCombinations(i + 1, sum + i, k - 1, target, combinations, res);
combinations.remove(combinations.size() - 1);