Search
⌘K

Leetcode 1905. Count Sub Islands

Count how many islands (4-directionally connected 1s) in grid2 are entirely contained within corresponding land cells in grid1 — traverse each island in grid2 (DFS/BFS) and verify every cell is 1 in grid1.


Question Timeline

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

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