k
numbers and the remaining sum is 0, add the combination to the result.k
numbers, iterate over the possible next numbers from the current number to 9.n
, add it to the current combination and recursively call the helper function with the updated parameters.