You are given an m x n
grid representing a box of oranges. Each cell of the grid can have one of the following values:
0
: an empty cell1
: a fresh orange2
: a rotten orange
Each minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten.
Your task is to return the minimum number of minutes that must elapse until no cell has a fresh orange. If this is impossible, return -1
.