All ways to build a notional from lot sizes
Asked at IMC
You can trade in a fixed set of lot sizes, each usable any number of times. List every distinct combination of lots that sums exactly to a target notional. Combinations are unordered, so [2, 3, 3] and [3, 2, 3] are the same and should appear once.
denoms = [2, 3, 5], target = 8
-> [[2, 2, 2, 2], [2, 3, 3], [3, 5]]
Return all combinations summing to the target, with unlimited reuse and no duplicates.
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.