Number of Islands

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

An island is formed by land cells connected horizontally or vertically. Cells outside the grid are wa...

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: