Search
⌘K

Leetcode 3531. Count Covered Buildings

Given unique building coordinates on an n×n grid, count how many buildings have at least one other building strictly above, below, left, and right (i.e., same column with both smaller and larger x and same row with both smaller and larger y). The typical approach groups coordinates by row and column to efficiently check those four directional existences for up to 1e5 buildings.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.