Meta Interview Question

next permutation in a string