Solution: Combination Sum
Explore how to solve the Combination Sum problem by implementing a dynamic programming strategy. Understand how to use a dp table to store and build unique combinations of numbers that sum up to a target, improving efficiency over naive recursive methods.
Statement
Given an array of distinct integers, nums, and an integer, target, return a list of all unique combinations of nums where the chosen numbers sum up to the target. The combinations may be returned in any order.
An integer from nums may be chosen an unlimited number of times. Two combinations are unique if the
frequency of at least one of the chosen integers is different.
Constraints:
-
nums.length -
nums[i] -
target