DIY: Max Area of an Island
Solve the interview question "Max Area of an Island" in this lesson.
We'll cover the following
Problem statement
Given an m x n
binary matrix grid containing 0
s and 1
s, you have to return the maximum contiguous area that is occupied by an island.
Each cell in the grid represents either land or water. A cell with 1
represents land, while a cell with 0
represents water. A bunch of four-directionally adjacent cells with the value 1
constitutes an island.
The area of an island is the number of cells with a value 1
in the island.
Note: You may assume that all four edges of the grid are surrounded by water.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.