Qm
BrainteasersJane StreetCitadel

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

Sign in to join the discussion · reading is open to everyone

💡 Discussion rules

  1. No full solutions here. Hints and approaches only.
  2. Complexity, edge cases and intuition are the point.
  3. Interview experiences are welcome. Respect your NDAs.

Loading discussion…

Learn the concepts

The theory behind this question.

Related questions

Snapping a 6-by-8 chocolate bar into squaresSeven glasses, flip exactly four at a timeA grasshopper that only jumps diagonallyCan a 4 and a 6 minute glass ever measure 7 minutes?Jumping coins cannot build a bigger square
All questions →