Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

What is the minimum number of knight moves needed to go from square (0, 0) to (3, 3) on an 8 by 8 board (coordinates 0 to 7)?

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

Correct answer: C. 2

A breadth-first search over knight moves gives the minimum. The two-move route is (0,0) to (1,2) to (3,3), and no single move reaches it.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic