You have a grid where 0 = empty, 1 = fresh orange, 2 = rotten orange. Every minute, fresh oranges adjacent (4-directionally) to rotten ones become rotten. Return the minimum minutes until no fresh orange remains, or -1 if impossible.
This is a classic multi-source BFS problem:
Think of it as a flood fill spreading from multiple sources simultaneously. Time: O(m×n).
oranges_rotting(grid)
4