Solved LeetCode program · 39 of 1,000
#0039 · Combination Sum
Original English source
Keep a shared nums holding 2, 3, 6, and 7. Keep a shared target of 7. Keep a shared parts as an empty list of text. Keep a shared answers as an empty list of text.
To combine from index (a whole number) with total (a whole number). If total is target, The built is join parts with ",", Place built into answers, then return. If total is more than target, return. If index is at least 4, return.
For every position from index to 3.
The value is item position of nums.
If total plus value is at most target.
The piece is format whole number value as text. Place piece into parts. Combine from position with total plus value. Remove the last item from parts.
Combine from 0 with 0. For each answer in answers, show answer.
Expected stdout
2,2,3 7