Number of Islands
Given an m×n grid of characters '1' (land) and '0' (water), count the number of islands. An island is formed by land cells connected horizontally or vertically (diagonals do not count).
Input: th...
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:
