Max Area of Island (without modifying the input grid)

Given an m x n binary matrix grid where 1 is land and 0 is water, an island is a group of 1s connected 4-directionally (up, down, left, right). Return the maximum area of an island, or 0 if there is...

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: