Data Structures & AlgorithmsVery hardICPC regional · GATE CS top band

2 × 3 sliding puzzle with tiles 1 to 5 and one blank (shown as _). Current board: 4 2 _ / 5 1 3. 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. 11
  2. B. 4
  3. C. 5
  4. D. 7

Correct answer: D. 7

A BFS over all 360 reachable boards from the goal gives 7. 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