Problems / Graphs / Walls and Gates
#86 Medium Time O(m·n) Space O(m·n) Animated

Walls and Gates

Fill each room with the distance to its nearest gate.

LeetCode ↗
Approach: BFS
Click play to start
Step 0 / 0
Press play to start the visualization.

Steps