Skip to content

Latest commit

 

History

History

shortest-path-to-get-food

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

< Previous                  Next >

Related Topics

[Array] [Breadth-First Search] [Matrix]

Similar Questions

  1. 01 Matrix (Medium)
  2. Shortest Path in a Grid with Obstacles Elimination (Hard)

Hints

Hint 1 Run BFS starting from the '*' position.
Hint 2 Keep the current number of the steps as a state in the queue.
Hint 3 The first time you reach a food, return the number of steps as the answer.
Hint 4 In case the queue is empty and you still did not manage to reach a food, return -1.