Find all combinations of a given set of integers summing up to a given sum
I am looking for an answer to the following problem. Given a set of integers (no duplicates) and a sum, find all possible combinations of the set's elements summing up to the sum. Solutions order does not matter (solutions {2, 2, 3} and {3, 2 ,2} are equal). Please note that the final combination does not need to be a set, as it can contain duplicates. Example: Set {2,3,5} Sum 10 Result: {2, 2, 2, 2, 2}, {2, 2, 3, 3}, {2, 3, 5}, {5, 5} I've looked at Subset Sum problem as well as Coin Change problem, but couldn't adapt them to suit my needs. I am not really familiar with dynamic programming,