Tap here to switch tabs
Problem
Submissions

Problem: Number of Closed Islands

Try to solve the Number of Closed Islands problem.

Statement

Given a two dimensional grid consisting of 00s (representing land) and 11s (representing water), an island is a maximal group of 00s connected horizontally or vertically.

A closed island is an island that is completely surrounded by 11s on all four sides (top, bottom, left, and right), meaning it does not touch the boundary of the grid.

Return the total number of closed islands in the grid.

Constraints:

  • 1≤1 \leq grid.length, grid[0].length ≤100\leq 100

  • 0≤0 \leq grid[i][j] ≤1\leq 1

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Closed Islands

Try to solve the Number of Closed Islands problem.

Statement

Given a two dimensional grid consisting of 00s (representing land) and 11s (representing water), an island is a maximal group of 00s connected horizontally or vertically.

A closed island is an island that is completely surrounded by 11s on all four sides (top, bottom, left, and right), meaning it does not touch the boundary of the grid.

Return the total number of closed islands in the grid.

Constraints:

  • 1≤1 \leq grid.length, grid[0].length ≤100\leq 100

  • 0≤0 \leq grid[i][j] ≤1\leq 1