Combinations Summing to a Target with Reusable Numbers

Asked at IMC Trading · Coding Questions · Difficulty: Medium

Given an array of distinct positive integers `nums` and a positive integer `target`, return every distinct combination of numbers from `nums` that sum to `target`. Each number may be used any number of times. Two combinations are different if they differ in how many times some number is used; the order of the numbers inside a combination does not matter.

Loading the problem…