Algorithm · Oracle · Medium
Given a rectangular binary matrix grid, each entry is 1 (land) or 0 (water). Call two land cells part of the same island when one can walk to the other across land using only the four cardinal directions, and treat an island as a maximal set of cells linked that way. An island is closed when no cell of it lies on the outermost row or column of the matrix. Return the number of closed islands. The same requirement can be viewed differently: imagine washing away every land cell…
Checking your access…