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

Unlock AI-Powered LearningUpgrade to smarter learning with instant explanations of Ask Agent, Personalized Interview Prep, Real-World Projects, 3 AI Mock Interviews per month, and Personalized Paths
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

Unlock AI-Powered LearningUpgrade to smarter learning with instant explanations of Ask Agent, Personalized Interview Prep, Real-World Projects, 3 AI Mock Interviews per month, and Personalized Paths