Relative Content

Tag Archive for javaperformance

How to find all possible combinations of a list of integers?

In Java I want a method that finds all possible combinations when there is a fixed number of slots and a fixed sum total for the values. For example if the sum total is 4 and there are 2 slots then these are all the possible combinations: