Problem. Given distinct positive integers candidates and a target, return all unique combinations of
candidates that sum to target. A candidate may be used any number of times. Combinations are unordered:
[2, 2, 3] and [3, 2, 2] are the same.
candidates = [2, 3, 6, 7], target = 7 → [2, 2, 3], [7]
candidates = [2, 3, 5], target = 8 → [2, 2, 2, 2], [2, 3, 3], [3, 5]
candidates = [2], target = 1 → (none)
Compared with lesson 8.4's combination sum II, two things change: no duplicates in the input, and reuse is allowed, so the recursion must be able to pick the same candidate again.
ML context. "Which multisets of allowed sizes add up to exactly this?" is a capacity question: splitting a global batch of 96 into micro-batches of sizes the kernels are tuned for, filling a node's GPU memory with replicas of different model sizes, composing a request budget from instance types. Often you need not the list but the count of ways, and that's a dynamic programming problem (Change A).