Generating permutations in lexicographic ordering

Sign in to test your solution.