Rotting Oranges
Medium📝 Description
Calculate time until all fresh oranges are rotten (BFS)
Input Format
2D grid (0=empty, 1=fresh, 2=rotten)
Output Format
Minutes elapsed or -1 if impossible
Constraints
m == grid.length n == grid[i].length
🔍 Sample Input
[[2,1,1],[1,1,0],[0,1,1]]
✅ Sample Output
4
Code Editor
Please login to run and submit code.
Results
Suggested Solution
Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run