Problem 1091 · Medium

Shortest Path in Binary Matrix

Run a breadth-first search over open cells in all eight directions; the first time the corner is reached gives the shortest length.

Open the interactive visualisation