Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Run BFS starting from the '*' position.
Keep the current number of the steps as a state in the queue.
The first time you reach a food, return the number of steps as the answer.
In case the queue is empty and you still did not manage to reach a food, return -1.