LeetCode 286: Walls And Gates — Step-by-Step Visual Trace
Medium — BFS | Matrix | Graph
The Problem
Fill each empty room with the distance to its nearest gate, where rooms are represented by a 2D grid with gates (0), walls (-1), and empty rooms (INF).
Approach
Use multi-source BFS starting from all gates si...
blog.tracelit.dev2 min read