Available question text
Count the number of land cells (1s) that belong to connected components that cannot reach the grid boundary. The core challenge is to identify and exclude all land reachable from the boundary (e.g., via BFS/DFS flood-fill) and return the size of the remaining enclosed components; m,n ≤ 500 so an O(mn) solution is expected.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1020. Number of Enclaves
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source