The fifteen puzzle with two tiles swapped
The fifteen puzzle is a 4 by 4 frame holding fifteen numbered sliding tiles and one empty space. A move slides a tile adjacent to the empty space into it.
The puzzle is set up in the solved position (1 to 15 in reading order, empty space at bottom right) except that tiles 14 and 15 have been swapped. In 1880 a prize of 1,000 dollars was offered for solving it.
Can it be solved? Prove your answer.
Show a hint
Read the tiles in order, treating the empty space as tile 16, and count the number of pairs that are "out of order" (a larger number before a smaller one). Then look at how a single slide changes that count, together with the row of the empty space.
Your answer
Solving needs a free account
Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.
Discussion
💡 Discussion rules
- No full solutions here. Hints and approaches only.
- Complexity, edge cases and intuition are the point.
- Interview experiences are welcome. Respect your NDAs.
Loading discussion…
Learn the concepts
The theory behind this question.