Number of Closed Islands

Problem

Given an m × n binary matrix grid, where 0 represents land and 1 represents water, return the number of closed islands.

An island is a maximal connected component of land using onl...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: