01 · Question
Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may use the same number unlimited times.
Candidates and target are positive integers.
02 · Analysis
Candidates are distinct positive integers and target is positive. Taking a candidate keeps the same index so it may be reused; skipping moves to the next index, which prevents order-only duplicate combinations. Stop at remaining==0 or when no candidates remain. If the minimum candidate is c, at most floor(target/c) values fit in a path; the search is exponential in the number of choices and depth, with auxiliary space bounded by candidate count plus that depth. Include copied answers separately.