Combination Sum
Medium
Arrays
Array
Backtracking
Find all unique combinations summing to target. Reuse allowed.
Constraints
1 ≤ candidates.length ≤ 30
Examples
Example 1:
Input: 2 3 6 7
7
Output: 2 2 3
7
Example 2:
Input: 2 3 5
8
Output: 2 2 2 2
2 3 3
3 5
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console