62. Shortest Path in a Grid (BFS)
MediumGraphs
grid contains 0 (open) and 1 (wall). Moving up, down, left or right, return the fewest steps from the top-left to the bottom-right cell, or -1 if it cannot be reached.
Example 1
Input: grid = [[0, 0, 0], [1, 1, 0], [0, 0, 0]] Output: 4
Constraints
1 ≤ rows, columns ≤ 100