
You are given a 2D grid maze of size m x n where:
0
represents an open cell
1
represents a wall (cannot pass)
You are also given a start cell (sr, sc) and a target cell (tr, tc).
From any open cell, you may move up, down, left, or right by 1 step (no diagonals), staying within bounds.
Return the minimum number of steps required to reach the target from the start. If it is impossible, return -1.
maze: int[][]
,
start: int[2]
,
target: int[2]
int
(minimum steps or
-1
)
1 <= m, n <= 200
maze[sr][sc] == 0
and
maze[tr][tc] == 0