1

PROBLEM OF THE DAY: 16/10/2023 | Making A Large Island

 11 months ago
source link: https://www.geeksforgeeks.org/videos/problem-of-the-day-16102023-making-a-large-island/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

PROBLEM OF THE DAY: 16/10/2023

October 17, 2023 |400 Views
PROBLEM OF THE DAY: 16/10/2023 | Making A Large Island
Problem of the Day, graph, Data Structure and Algorithm
 Save  Share   Like
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Devashsish Khare. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Graph but will also help you build up problem-solving skills.

In this problem, we are given, an n x n binary matrix grid. You are allowed to change at most one 0 to be 1. A group of connected 1s forms an island. Two 1s are connected if they share one of their sides with each other.

Return the size of the largest island in the grid after applying this operation.

Example :

Input: 
grid = [[1,0],[0,1]]
Output:
3

Explanation:
Change any one 0 to 1 and connect two 1s, then we get an island with area = 3.

Give the problem a try before going through the video. All the best!!!

Problem Link: https://practice.geeksforgeeks.org/problems/making-a-large-island/1

Read More

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK