Problem 2257 · Medium

Count Unguarded Cells in the Grid

Sweep out from every guard in four directions until a wall or another guard, marking the cells it sees as guarded.

Open the interactive visualisation