Rotting Oranges
You are given an m x n grid where each cell can have one of three values: 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 cell has a fresh orange. If impossible, return -1.
Rotting Oranges

You are given an m x n grid where each cell can have one of three values: 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 cell has a fresh orange. If impossible, return -1.

Example 1:
Input: [[2,1,1],[1,1,0],[0,1,1]]
Output: 4
Input
arr =[[2,1,1],[1,1,0],[0,1,1]]
🥼
🍊
🍊
🍊
🍊
🍊
🍊
Minutes Elapsed

0

Found 1 rotten, 6 fresh oranges

Empty
Fresh
Rotten
Variables
VariableValue
fresh6
rotten1
DepthFunction Call
Stack empty
0/9