Amazon interview question

permutations of string, run time