Minimum Knight Moves

BFS

Problem

Thought Process

  • We care about the levels in this problem

  • Infinite chess board meaning no boundaries

  • BFS to look at all the neighbors

Solution

Time Complexity:

  • Time: O(n) where n is the number of moves we have to make

  • Space: O(n) where n is the number of moves we have to make

Last updated

Was this helpful?