Given a set of integers, which Java algorithm will produce combinations as follows.
Given the collection example: [1,3,5], we need the conclusion:
[1-1] [3-3] [5-5] [1-3] [1-5] [3-5]
Note that order is not important, so we want one of [1-3], [3-1], but not both.
This should work with a set of n numbers, not just three numbers, as in this example.
source share