(Leetcode) Combinatorial Sum - How to generate solution set from number of solution sets?
Suppose that the candidates are $x_1,\ldots,x_n$ and the target is $T$. I'm assuming all candidates are positive. If $T &lt; 0$ then there are no solutions. If $T = 0$ then the only solution is the empty solution. Otherwise, there are two kinds of solutions:


$x_1$ together with a solution for $T - x_1$ using all candidates.
A solution for $T$ using the candidates $x_2,\ldots,x_n$.


Using this, you can easily write a recursive procedure that generates all solutions.