You are given an m x n grid rooms filled with three possible values:
-1 - a wall or obstacle0 - a gate2147483647 - INF (= 2^31 - 1), representing an empty roomFill each empty room with the distance to its nearest gate. If it is impossible to reach a gate, leave it as 2147483647. Modify rooms in-place; the function returns None.
INF = 2147483647 rooms = [ [INF, -1, 0, INF], [INF, INF, INF, -1], [INF, -1, INF, -1], [ 0, -1, INF, INF] ]
Input: rooms above
Output: [[3, -1, 0, 1], [2, 2, 1, -1], [1, -1, 2, -1], [0, -1, 3, 4]]
Explanation: Each empty room is filled with the shortest distance to the nearest gate.
Rooms that cannot reach any gate remain INF (2147483647 in output).
rooms = [[INF, -1, INF], [-1, 0, -1], [INF, -1, INF]]
Input: rooms above
Output: [[2147483647, -1, 2147483647], [-1, 0, -1], [2147483647, -1, 2147483647]]
Explanation: The gate at the center is completely surrounded by walls,
so none of the corner rooms can be reached.
m == rooms.lengthn == rooms[i].length1 <= m, n <= 250rooms[i][j] is one of -1, 0, or 2147483647rooms = [[INF, -1, 0, INF], [INF, INF, INF, -1], [INF, -1, INF, -1], [0, -1, INF, INF]]