added the code without comments on findAllCombinations