Problem: Combination Sum
Understand how to apply recursion with backtracking to find all unique combinations of numbers that sum to a target value. Learn to handle unlimited reuse of candidates, avoid duplicates, and optimize with pruning techniques for efficient problem-solving.
We'll cover the following...
Statement
Given an array of distinct integers candidates and a target integer target, return all unique combinations of numbers from candidates that sum up to target. The combinations may be returned in any order.
Each number in candidates may be selected an unlimited number of times. Two combinations are considered unique if they differ in the frequency of at least one chosen number.
Note: The test cases are designed such that the total number of unique combinations summing to
targetis less thanfor any given input.
Constraints:
candidates.lengthcandidates[i]...