Implemtation of allCombinations test to Problem2