Data Structures & AlgorithmsModerateGATE CS · Codeforces Div 2

On an 8 × 8 chessboard with rows and columns numbered 0 to 7, a knight starts at (1, 0) and must reach (2, 5) (as (row, column)). A knight move is the usual L shape (two in one direction and one perpendicular), and all squares are available. What is the minimum number of knight moves?

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

Correct answer: B. 4

A BFS over knight moves gives 4; the Chebyshev or Manhattan distance ignores the L-shape, which is why both are wrong.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic