Restore the data order
Array indexes and swaps
Restore the data order
Goal
Sort the five values from smallest to largest in at most 4 swaps.
Preview board
Not runAdd instructions, then run your pseudocode.
Pseudocode
0 / 4 instructionsReady to run.
How it works
Array indexes and swaps
Track values separately from their array positions.
Key rule
Positions start at 1 in this simulator. SWAP exchanges two existing positions and preserves the values.
Worked example
Different example: [3,1,2] becomes [1,3,2] after SWAP(1,2). Compare each neighboring pair to check order.
Win condition
Complete the pseudocode and concept check.
Show a hint
Place the smallest remaining value in its final position, then continue right.
Edit text
Enter one instruction per line. You can use the displayed pseudocode or commands from the reference.