Number of Islands

Number of Islands

Given an m × n grid grid of characters '0' (water) and '1' (land), return the number of islands.

An island is formed by horizontally or vertically adjacent land cells. C...

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: