dsa · medium

Combination Sum (reuse allowed)

GreyOrangeDynamic ProgrammingRecursionBacktracking

Candidates nums (distinct positives) and target t. Return **all unique combinations** that sum to t; you may reuse numbers. Order of combinations and of numbers inside does not matter.

Arguments

**Example:** nums=[2,3,6,7], t=7[[2,2,3],[7]].

Constraints

1 <= nums.length <= 30, 1 <= t <= 40

Examples

Example 1

Input:
[2,3,6,7]
7

Expected:
[[2,2,3],[7]]

Open in the Dojo editor