#3531
Count Covered Buildings
specialist · 740 · lc medium +31 · 58.7% accepted · 440 likes · top 55%
Description
An n x n city grid has buildings at positions given by buildings[i] = [x, y]. A building is "covered" when at least one other building exists in each of the four cardinal directions (left, right, above, below) relative to it.
Return the total number of covered buildings.
Code
1
2
3