This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: May 04, 2007
I am trying to use the combination rule of "n!/r!(n-r)!" but here is the pbm according to this if I wanted all the combinations for a particular number of pairs eg all two pair values ... eg 1, 2, 3, 4 the outcome would be (1,2) , (2,3) , (3,4) , (1,3) (1,4) , (2,4)
but I need all possible pairs say all 2 pairs, 3 pairs , 4 pairs etc... is it a good way to wrap it with a loop and pass the "r" value for each loop or is there a way to figure this out. Any help is highly appreciated.