How to solve permutations and combinations