140: Combination sum 3

Given k integer and a target sum , return all unique combinations of [1 - 9] k numbers that add up to the given sum

Note: Each [1 - 9] number can be used only once

 

Example 1

Input:   k = 2, sum = 6

Output:  [[1, 5], [2, 4]]

Example 2

Input:   k = 3, sum = 7

Output:  [[1, 2, 4]]
Difficulty:Medium
Topic:Backtracking
Problem #:140