LeetCode 1091 Shortest Path in Binary Matrix - Problem Statement

The problem

Given an n × n binary matrix, find the shortest clear path from top-left to bottom-right.

A clear path consists of cells with value 0. You can move in 8 directions (including diagonals).

With grid:

0 0 0
1 1 0
1 1 0

The shortest path: (0,0) → (0,1) → (0,2) → (1,2) → (2,2). Length: 5.

If no clear path exists, return -1.

Constraints: 1n1001 \le n \le 100. Path length counts cells visited, including start and end.