Algorithm · Disney · Medium
A grid holds oranges, some fresh and some rotten. Every minute, any fresh orange that sits next to a rotten one becomes rotten as well. Return the number of minutes that must pass before the grid contains no fresh oranges at all. If some fresh orange can never become rotten, return -1 instead. Examples Example 1 Example 2