Algorithm · Uber · Medium
You are given a two-dimensional grid containing 0 for water and 1 for land. Determine the greatest area among all islands in the grid. An island consists of land cells connected through horizontal or vertical neighbors; diagonal contact does not connect cells. The outer border of the grid can be treated as water. Implement a function that returns the maximum island area and is suitable for grids of varying sizes and layouts. Examples Example 1 The only land cell forms an…
Checking your access…