Rotting Oranges
Medium
Queue
In an R x C grid, 0 is an empty cell, 1 is a fresh orange and 2 is a rotten orange. Every minute, each fresh orange that is 4-directionally adjacent to a rotten one becomes rotten. Print the minimum minutes until no fresh orange remains, or -1 if that is impossible.
Constraints
1 <= R, C <= 10 Each cell is 0, 1 or 2
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.