Count Islands and Compute Coastline Length
Given a 2D grid of land and water, compute:
- The number of islands. An island is a connected component of land cells connected vertically or horizontally.
- The total coastline length. A side of a...
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:
