Walls and gates
A grid holds walls, gates and empty rooms. Fill every empty room with the distance to its nearest gate, leaving rooms that cannot reach a gate untouched. Use one multi-source BFS starting from all gates.
No answer yet. Write the first one; the best answer gets endorsed.
