Practice Problem

Walls and Gates

Difficulty: Medium

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