Rotting Oranges
Asked at Uber · Coding Questions · Difficulty: Easy · Last asked Apr 13, 2026
You are given an `m x n` grid where `0` is an empty cell, `1` is a fresh orange, and `2` is a rotten orange. Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten. Return the minimum number of minutes needed until no fresh orange remains, or `-1` if it is impossible.
Loading the problem…