Problem 604. Next lexicographic - permutation
Find next lexicographic - permutation (permutations as it would occur in a dictionary order).
E.g: nextP('ABCD') = ABDC
If you can generate the next permutation, then you can also generate a 'cycle' of all permutations using a construct like,
For fun, you could generate all the n! permutations of a, unique n-letter string.
Solution CommentsShow comments
Problem Recent Solvers49