Amazon Interview Question

Efficiently produce all permutations of a string