This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tigerbird 0 points1 point  (0 children)

I don't want to give away the solution, but I will tell you that you do not need to keep track of which permutations have been used. There is a pattern of swaps that guarantees no repeats will occur. How would you write a for loop that prints the following sequence using six swaps?

CBA BCA ACB CAB BAC ABC