Practice
/

Walls and Gates

Walls and Gates

Given a grid with walls, gates, and empty rooms, fill each empty room with the distance to its nearest gate using multi-source BFS.

Premium Content

Create a free account, then unlock this problem and the entire premium catalog with a one-time CodeSnatch Premium purchase.

Already have an account with premium access? Sign in to continue.