eBay interview question

finding all permutations of a string with minimum complexity