Microsoft interview question

They asked me to permute a string