Leetcode 994. Rotting Oranges
Given an m×n grid with empty cells, fresh (1) and rotten (2) oranges, compute the minimum minutes until all fresh oranges become rotten as rot spreads 4-directionally each minute, returning -1 if any fresh orange is unreachable. This is a multi-source BFS/level-order propagation problem starting from all initial rotten oranges.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early August, 2026
You are given an m x n grid where each cell can have one of three values: 0 representing an empty cell, 1 representing a fresh fruit, or 2 representing a rotten fruit. Every minute, any fresh fruit that is 4-directionally adjacent to a rotten fruit becomes rotten. Return the minimum number of minutes that must elapse until no cell has a fresh fruit. If this is impossible, return -1.
Late May, 2026
Rotting Oranges LC.
Early May, 2026
Hello Interview Premium
Your account is free and you can post anonymously if you choose.