Data Structures & AlgorithmsVery hardCodeforces Div 2 · ICPC regional

2 × 3 sliding puzzle with tiles 1 to 5 and one blank (shown as _). Current board: 2 4 3 / 1 5 _. Goal board: 1 2 3 / 4 5 _. A move slides a tile that is orthogonally adjacent to the blank into the blank. What is the minimum number of moves to reach the goal?

  1. A. 3
  2. B. 6
  3. C. 4
  4. D. 10

Correct answer: B. 6

A BFS over all 360 reachable boards from the goal gives 6. Counting misplaced tiles or summing Manhattan distances are lower-bound heuristics, not the exact answer.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic