Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Walls and Gates

In a grid, -1 is a wall, 0 is a gate and 2147483647 is an empty room. Fill each room with the distance to its nearest gate (leave it as 2147483647 if unreachable).

Constraints

1 <= r, c <= 250

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.