Rotting Oranges
Try to solve the Rotting Oranges problem.
We'll cover the following
Statement
Consider an
, which indicates an unoccupied cell. , representing a freshly picked orange. , indicating a rotten orange.
Any fresh orange that is 4–directionally adjacent to a rotten orange will also turn rotten with each passing minute.
Your task is to determine the minimum time required for all cells to have rotten oranges. In case, this objective cannot be achieved, return
Constraints:
m
grid.length
n
grid[i].length
m
,n
grid[i][j]
 isÂ0
,Â1
, orÂ2
.