Deviopath › JavaScript

Combination Sum

Hard · Recursion

Write a function combinationSum that finds every combination of numbers from candidates that adds up to target. The same number may be used any number of times. All candidates are different positive integers.

Each combination must be sorted ascending, and the list of combinations must be in lexicographic order (compare number by number from the left). If there is no combination, return [].

Next: Curry With Placeholders