solulubeta
Sign in
NeetCode 150 / Graphs
11.07 · Problem

Walls and Gates

Medium Multi-source BFS from the gates 1 video LC 286 Pro

This problem is part of solulu Pro

A grid of rooms holds -1 (wall), 0 (gate) or 2147483647 (an empty room, call it INF). Fill each empty room in place with the distance (in 4-directional steps) to its nearest gate. Rooms that can't reach any gate stay…

Lifetime ₹1,999 ₹999 · Launch offer
Mark this problem as solved when you are finished.

Item 86 of 150 · updated 2026-10-12