LeetCode 695 Max Area of Island - Problem Statement

The problem

Given a binary grid where 1 is land and 0 is water, find the largest island's area.

An island is a group of 1's connected horizontally or vertically. The area is the number of cells.

With grid:

0 0 1 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 1 1 1 0 0 0
0 1 1 0 1 0 0 0 0 0 0 0 0
0 1 0 0 1 1 0 0 1 0 1 0 0
0 1 0 0 1 1 0 0 1 1 1 0 0
0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 1 1 1 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0

The largest island has area 6.

Constraints: Grid up to 50×5050 × 50.