Module 8 · Graphs and Trees · BFS on Grid

Rotting oranges

Every rotten orange starts in the queue together, so the rot spreads from all of them at the same time. Each level of the queue is one minute; fresh oranges the BFS never reaches stay fresh forever.