Number of potholes in a 2D matrix
Filed under HashedIn
The question
Given a 2D binary grid of 0s and 1s, count the number of connected components of 1s (potholes), where connectivity includes all 8 directions (horizontal, vertical, diagonal).
No write-up yet. Related questions below have one.
Related HashedIn questions
Collected from public candidate posts and coding forums. Updated Nov 2026.