Number of Islands - Leetcode 200 - Graphs (Python)

  Рет қаралды 12,651

Greg Hogg

Greg Hogg

Күн бұрын

Пікірлер: 40
@GregHogg
@GregHogg 5 ай бұрын
Master Data Structures & Algorithms For FREE at AlgoMap.io!
@CyrusWong-yq4uw
@CyrusWong-yq4uw 4 ай бұрын
I am a Secondary student who is currently learning Python in the coding class in school and at home by myself, and I was doing this leetcode question and find this diffcult. So I looked up on KZbin and found this video, this video gives me a very clean concepts of this question for what to do. Thank you so much!
@tauicsicsics
@tauicsicsics 5 күн бұрын
Absolutely fantastic solution Greg, "flooding" (mark it with zeros) the island after found it is a great idea and a lot easier to understand then holding a "set". Please do all neetcode 169 and grind 169 problems, thank you!!
@MuhammadFahreza
@MuhammadFahreza 4 ай бұрын
Totally love the explanation. Your voice is very stable so really like it !
@GregHogg
@GregHogg 4 ай бұрын
Very glad to hear it!
@jameshizon4861
@jameshizon4861 7 ай бұрын
Had this question in interview with Disney for consulting. Thankfully I at least skimmed solution beforehand. Only had ~70% of coding part but answered most of other qs & hope I move forward.
@GregHogg
@GregHogg 5 ай бұрын
Did you move forward?
@chrischika7026
@chrischika7026 3 ай бұрын
did you
@louisuchihatm2556
@louisuchihatm2556 Ай бұрын
Bro, updates.
@jameshizon4861
@jameshizon4861 Ай бұрын
Lol no they didnt think I was good fit. Perhaps my mental health from layoff getting to me. I did start a startup tho lol
@mint6547
@mint6547 3 ай бұрын
i’ve been killing my brain all day over this , not being able to comprehend some other solutions i saw but this makes so much more sense to me and it’s so well explained (have an interview tomorrow ) 😭😭
@amalnasir9940
@amalnasir9940 2 күн бұрын
Best explanation for this problem everr!!! You made it so clear. Thank you sir!!
@VictorSantos-ih3lb
@VictorSantos-ih3lb Ай бұрын
you turned this question easier, thanks for the explanation, really clear solution
@ahmedismail._
@ahmedismail._ 16 күн бұрын
Best explanation I've found on this
@Jul19n
@Jul19n 3 ай бұрын
This really helped me out, been struggling w bfs/dfs and you cleared it up thanks!
@ulisesgtzr
@ulisesgtzr Ай бұрын
Dude!!!!! thanks so much your explanations are very clean and simple!
@nerik85
@nerik85 11 күн бұрын
Holy fuck, that crystal clear explanation. mad respect
@dhruva1221
@dhruva1221 4 ай бұрын
Thanks Greg for the proper & detailed explanation espl updating grid position :) That helped me after looking up solution from 3 more places before.
@GregHogg
@GregHogg 4 ай бұрын
Amazing ❤️
@ektasingh5967
@ektasingh5967 2 ай бұрын
Amazing explanation Greg!
@saleheen1
@saleheen1 Ай бұрын
After watching it for few days, I am like: Oh yeah, this is a cool problem, now that I understand.
@Jollez
@Jollez Ай бұрын
Studying for Zon SDEI this is amazing
@mohammadamintorabi8415
@mohammadamintorabi8415 5 ай бұрын
Can you explain the "flow" of execution. When a recursive function calls itself, the execution flow "pauses" at the line where the recursive call is made and a new instance of the dfs function starts executing from the beginning, thats little bit hard to imagine and follow in mind
@tkadosh
@tkadosh 4 ай бұрын
Amazing explanation 😄 thanks a lot
@adithyar3160
@adithyar3160 3 ай бұрын
Awesome Explanation my fav Canadian man
@GregHogg
@GregHogg 3 ай бұрын
🇨🇦🇨🇦
@dima.garotas
@dima.garotas 3 ай бұрын
Hi, thanks for this video, just a quick question: why do we need to do dfs in up and left directions? These cells will be already considered (before (i,j) cell), because main function traverses grid from left to right, from up to buttom?
@josephsypniewski3443
@josephsypniewski3443 2 ай бұрын
imagine a simple graph of [[1,1], [0,1],[1,1]] This is one island. now if we arent searching up or left (in this case only left matters but it illustrates the point). So we start at (0,0) and change it from 1 to zero, we check down and its a zero so we dont continue that path, we check right change value, check down and change value and then end the call, which leaves us with all zeroes except for the bottom right index because we never moved left from (2,1). So when our program reaches that index it will count it as another island, incorrectly giving us 2 islands instead of 1
@dima.garotas
@dima.garotas 2 ай бұрын
@@josephsypniewski3443 Got it, thanks a lot for the explanation!
@GarouNguyen
@GarouNguyen 5 ай бұрын
Thank you bro, wish you all the best
@GregHogg
@GregHogg 5 ай бұрын
You too!
@mateustoledo2835
@mateustoledo2835 5 ай бұрын
Thanks bro, I loved the explanation
@AnjanaOuseph
@AnjanaOuseph 2 күн бұрын
How did you say the time complexity is O(2 m*n)
@yassineouahmane4308
@yassineouahmane4308 7 ай бұрын
I have a question , I head that C++ is powerful than python solving problems especially in timelimit , do you think there is implementation in python that fill this gap between the two
@GregHogg
@GregHogg 7 ай бұрын
C++ will always be faster. But interviewers don't care what language you use.
@user-vany
@user-vany 7 ай бұрын
Hi, can you make a Meta-quest browser extension In which instead of a background? There will be transparent screens, well, or translucent ones, like Vision pro.
@GregHogg
@GregHogg 7 ай бұрын
What 😂
@user-vany
@user-vany 7 ай бұрын
​@@GregHogg I wanted to say if it is possible to make such a browser extension so that there is a transparent theme instead of the background. You can give an analogy: there is a light theme, there is a dark one, and it would be cool to add a transparent theme for AR headsets directly to the browser as an extension (sorry, I just use a translator 😃)
@venky3639
@venky3639 12 күн бұрын
Most asked question by meta
@saleheen1
@saleheen1 Ай бұрын
I search a problem, I don't it from Greg Hogg, I become sad. I don't want to watch it from anyone else. 😬
Max Area of Island - Leetcode 695 - Graphs (Python)
11:15
Greg Hogg
Рет қаралды 3,9 М.
NUMBER OF ISLANDS - Leetcode 200 - Python
11:41
NeetCode
Рет қаралды 342 М.
#behindthescenes @CrissaJackson
0:11
Happy Kelli
Рет қаралды 27 МЛН
УНО Реверс в Амонг Ас : игра на выбывание
0:19
Фани Хани
Рет қаралды 1,3 МЛН
Война Семей - ВСЕ СЕРИИ, 1 сезон (серии 1-20)
7:40:31
Семейные Сериалы
Рет қаралды 1,6 МЛН
Непосредственно Каха: сумка
0:53
К-Media
Рет қаралды 12 МЛН
Rotting Oranges - Leetcode 994 - Graphs (Python)
16:09
Greg Hogg
Рет қаралды 4 М.
Prefix Sum in 4 minutes | LeetCode Pattern
4:13
AlgoMasterIO
Рет қаралды 9 М.
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 676 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 1,1 МЛН
Clone Graph - Leetcode 133 - Graphs (Python)
13:38
Greg Hogg
Рет қаралды 4,6 М.
8 patterns to solve 80% Leetcode problems
7:30
Sahil & Sarra
Рет қаралды 471 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 462 М.
#behindthescenes @CrissaJackson
0:11
Happy Kelli
Рет қаралды 27 МЛН