Tap here to switch tabs
Problem
Submissions

Problem: Making A Large Island

med
30 min
Try to solve the Making A Large Island problem.

Statement

Given an n x n binary matrix grid, you are permitted to flip at most one cell from 00 to 11. After performing this operation, return the size of the largest island in grid.

An island is defined as a group of 11s that are connected in 44 directions (up, down, left, right).

Constraints:

  • n == grid.length

  • n == grid[i].length

  • 11 \leq n 500\leq 500

  • grid[i][j] is either 00 or 11

Tap here to switch tabs
Problem
Submissions

Problem: Making A Large Island

med
30 min
Try to solve the Making A Large Island problem.

Statement

Given an n x n binary matrix grid, you are permitted to flip at most one cell from 00 to 11. After performing this operation, return the size of the largest island in grid.

An island is defined as a group of 11s that are connected in 44 directions (up, down, left, right).

Constraints:

  • n == grid.length

  • n == grid[i].length

  • 11 \leq n 500\leq 500

  • grid[i][j] is either 00 or 11