Solving Combination Sum III in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description


  • All numbers will be positive integers.
  • The solution set must not contain duplicate combinations.

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]]

See the full details of the problem Combination Sum III at LeetCode

Originally posted at: