0=empty, 1=fresh, 2=rotten. Each minute, rotten oranges rot adjacent fresh ones. Find minimum minutes until no fresh remain, or -1 if impossible.
Classic multi-source BFS. Start from ALL rotten oranges simultaneously. Each BFS level = 1 minute.
💡 Pro tip: Understand this problem deeply — don't just memorize the code. Try explaining the approach out loud as if teaching a friend. If you can explain it simply, you truly understand it!
orangesRotting([[2,1,1],[1,1,0],[0,1,1]])
4