Tap here to switch tabs
Problem
Submissions

Problem: Making A Large Island

Making A Large Island gives you an n by n binary grid where islands connect up, down, left, or right. Flip at most one zero to one and return the largest island size.

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

  • 1≤1 \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

Making A Large Island gives you an n by n binary grid where islands connect up, down, left, or right. Flip at most one zero to one and return the largest island size.

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

  • 1≤1 \leq n ≤500\leq 500

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