In a grid, each cell is `0` (empty), `1` (fresh orange), or `2` (rotten orange). Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten.
Return the **minimum number of minutes** until no fresh orange remains. If this is impossible, return `-1`.
Example 1
Input:grid = [[2,1,1],[1,1,0],[0,1,1]]
Output:4
Explanation:After 4 minutes every reachable fresh orange is rotten.
Example 2
Input:grid = [[2,1,1],[0,1,1],[1,0,1]]
Output:-1
Explanation:The bottom-left orange is never reached.
Constraints
- m == grid.length
- n == grid[i].length
- 1 <= m, n <= 10
- grid[i][j] is 0, 1, or 2