Grokking Coding Mock Interview
Ask Author
Back to course home

0% completed

Vote For New Content

Solution: Making A Large Island
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Problem Statement

Given a 2D binary matrix of size n x n, return the integer representing the size of the largest island after changing at most 0 to 1.

Here, Island is defined as a 4-directionally connected group of 1s.

Examples

  • Example 1:
    • Input:
      [[1, 0, 1, 0],
       [0, 1, 1, 0],
       [0, 0, 0, 1],
       [1, 1, 0, 0]]
      
    • Expected Output: 6

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible