Max Area of Island
Medium · Graphs · about 15 minutes
Asked at Amazon, Meta, Google, Snowflake, Microsoft, DoorDash.
Given an m × n binary grid where 1 is land and 0 is water, return the area of the largest island (a group of 1s connected 4-directionally), or 0 if there is no land.