Problem: I have a list of numbers, e.g. numbers = [1, 2, 3, 7, 7, 9, 10] As you can see, numbers may appear more than once in this list. I need to get all combinations of these numbers that have a given sum, e.g. 10. The items in the combinations may ... length restrictions for the combinations, [10] is as valid as [1, 2, 7]. How can I create a list of all combinations meeting the criteria above?

asked
Feb 22
Ali
6.5k points