LeetCode 994: Rotting Oranges — Step-by-Step Visual Trace
Medium — BFS | Queue | Matrix | Graph
The Problem
Given a 2D grid representing oranges where 0=empty, 1=fresh orange, 2=rotten orange, determine the minimum time in minutes for all fresh oranges to rot, or return -1 if impossible.
Approach
Use BFS (B...
blog.tracelit.dev2 min read