Amazon Interview Question

permutations of string, run time