Approach Summary
BFS from top-left; explore 8-directional neighbours. First time we reach bottom-right is the shortest path.
How to Recognize This Pattern
- Shortest path in unweighted grid → BFS
- 8-directional movement including diagonals
Complexity Analysis
Time Complexity
O(n²)
Space Complexity
O(n²)
Tags
Array BFS Matrix