Amazon interview question

permutations of string