You are given a rectangular grid rooms of size m by n where each cell represents one of the following:
a wall with value
a gate with value
an empty room with value
Update rooms in place so that each empty room contains the distance to its nearest gate, measured as the minimum number of moves between adjacent cells sharing a side. If an empty room cannot reach any gate, its value must remain
Note: Modify
roomsin place and do not return anything.
Constraints:
m == rooms.length
n == rooms[i].length
m, n
rooms[i][j] is
You are given a rectangular grid rooms of size m by n where each cell represents one of the following:
a wall with value
a gate with value
an empty room with value
Update rooms in place so that each empty room contains the distance to its nearest gate, measured as the minimum number of moves between adjacent cells sharing a side. If an empty room cannot reach any gate, its value must remain
Note: Modify
roomsin place and do not return anything.
Constraints:
m == rooms.length
n == rooms[i].length
m, n
rooms[i][j] is