Max Area of Island - Leetcode 695

preview_player
Показать описание
Max Area of Island - Leetcode 695
Рекомендации по теме
Комментарии
Автор

Master graphs and all data structures and algorithms for FREE at AlgoMap.io!

GregHogg
Автор

I really like his channel, today I checked out his website as well where he has provided free resources. I highly recommend it to y'all. And, if you can please donate to support him ;)

If, not us this might help somebody else. Yes there are many othet options available. Still, you gotta give him props for this.

Thnaks!

Redditard
Автор

Both DFS and BFS work, but DFS is slightly better because you will end up with fewer visited islands.

xiahualiu
Автор

Why visited set is needed? We can directly mark it as 0. No need to use extra set here

shubhambhandari
Автор

flat the 2d array into 1d and iterate through it, if it finds a 1 increment a counter and when it reaches a 0 set a max to the counter, do that for all and setting max variable if max < counter

am i missing something or its just this easy?

ItzFlowerGMD
Автор

Now I have seen one that is finding the
n n
n
Tile with condition that upper left always zero(not a tile)

jumpjump-ozpr
Автор

Can you just iter on every element of the matrix and do this operation when enconutering a 1:
m[i][j] = m[i-1][j] + m[i][j-1] - m[i-1][j-1] + 1
And then return the max value obtained

leonardodanelutti
Автор

Solution: DFS combined with Graph theory
Big company: Good
Solution: Using AI to visualize the input image then return part of the image has the largest area
Big company: 💲💲💲💲

NovaH
Автор

pls refactor to not use range, and max out itertools.

DrDeuteron
Автор

that's a lot of operations, needs a better solution

mohamedislam
join shbcf.ru