You are given an integer n representing an n $ imes$ n grid and a buildings, where buildings[i] = [x, y] denotes the coordinates of a building on the grid.
A building at [x, y] is considered covered if there is at least one building in all four directions:
Above: a building at [x', y] with
Below: a building at [x', y] with
Left: a building at [x, y'] with
Right: a building at [x, y'] with
Return the total number of covered buildings.
Constraints:
n
buildings.length
buildings[i] = [x, y]
n
All coordinates of buildings are unique.
You are given an integer n representing an n $ imes$ n grid and a buildings, where buildings[i] = [x, y] denotes the coordinates of a building on the grid.
A building at [x, y] is considered covered if there is at least one building in all four directions:
Above: a building at [x', y] with
Below: a building at [x', y] with
Left: a building at [x, y'] with
Right: a building at [x, y'] with
Return the total number of covered buildings.
Constraints:
n
buildings.length
buildings[i] = [x, y]
n
All coordinates of buildings are unique.