How to solve permutation and combination