NeetCode #566LC-286MediumGraphsNC 150NC 250NC Algo100
← Back to All Problems

#566 · #286 · Walls and Gates(墙与门)

📌 Problem Statement & Constraints

You are given an m x n grid of rooms where -1 is a wall, 0 is a gate, and 2147483647 is an empty room. Fill each empty room with the distance to its nearest gate, or leave it as the sentinel if unreachable. Constraints: 1 <= m, n <= 250.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!