You are given a 2D binary grid where 0 represents land and 1 represents water. An island is a maximal 4-directionally connected group of land cells.
A closed island is an island that is completely (all four directions) surrounded by water cells (1s). This means it cannot touch any cell on the outer border of the grid. Return the number of closed islands.
Visualizer will appear here