Cognizant Interview Question

permutation and combination function