Walls and gates

0
Remix

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.

MetaOnline assessmentLast asked Jan 2026
No answer yet. Write the first one; the best answer gets endorsed.