Number of Islands - Leetcode 200 - Graphs (Python)

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии • 34

  • @GregHogg
    @GregHogg  4 месяца назад +1

    Master Data Structures & Algorithms For FREE at AlgoMap.io!

  • @CyrusWong-yq4uw
    @CyrusWong-yq4uw 3 месяца назад +6

    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 RUclips and found this video, this video gives me a very clean concepts of this question for what to do. Thank you so much!

  • @jameshizon4861
    @jameshizon4861 6 месяцев назад +12

    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  4 месяца назад +3

      Did you move forward?

    • @chrischika7026
      @chrischika7026 2 месяца назад

      did you

    • @louisuchihatm2556
      @louisuchihatm2556 11 дней назад

      Bro, updates.

    • @jameshizon4861
      @jameshizon4861 11 дней назад

      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

  • @VictorSantos-ih3lb
    @VictorSantos-ih3lb 8 дней назад

    you turned this question easier, thanks for the explanation, really clear solution

  • @MuhammadFahreza
    @MuhammadFahreza 3 месяца назад +6

    Totally love the explanation. Your voice is very stable so really like it !

    • @GregHogg
      @GregHogg  3 месяца назад +1

      Very glad to hear it!

  • @ulisesgtzr
    @ulisesgtzr 16 дней назад

    Dude!!!!! thanks so much your explanations are very clean and simple!

  • @Jollez
    @Jollez 15 дней назад

    Studying for Zon SDEI this is amazing

  • @mint6547
    @mint6547 2 месяца назад

    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 ) 😭😭

  • @Jul19n
    @Jul19n Месяц назад

    This really helped me out, been struggling w bfs/dfs and you cleared it up thanks!

  • @ektasingh5967
    @ektasingh5967 25 дней назад

    Amazing explanation Greg!

  • @mohammadamintorabi8415
    @mohammadamintorabi8415 4 месяца назад +2

    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

  • @dhruva1221
    @dhruva1221 3 месяца назад

    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  3 месяца назад

      Amazing ❤️

  • @tkadosh
    @tkadosh 3 месяца назад

    Amazing explanation 😄 thanks a lot

  • @adithyar3160
    @adithyar3160 2 месяца назад

    Awesome Explanation my fav Canadian man

    • @GregHogg
      @GregHogg  2 месяца назад

      🇨🇦🇨🇦

  • @mateustoledo2835
    @mateustoledo2835 4 месяца назад

    Thanks bro, I loved the explanation

  • @saleheen1
    @saleheen1 11 дней назад

    After watching it for few days, I am like:
    Oh yeah, this is a cool problem, now that I understand.

  • @GarouNguyen
    @GarouNguyen 4 месяца назад

    Thank you bro, wish you all the best

  • @user-vany
    @user-vany 6 месяцев назад

    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  6 месяцев назад +2

      What 😂

    • @user-vany
      @user-vany 6 месяцев назад

      ​@@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 😃)

  • @dima.garotas
    @dima.garotas 2 месяца назад

    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 25 дней назад +1

      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 25 дней назад

      @@josephsypniewski3443 Got it, thanks a lot for the explanation!

  • @yassineouahmane4308
    @yassineouahmane4308 6 месяцев назад

    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  6 месяцев назад +1

      C++ will always be faster. But interviewers don't care what language you use.

  • @saleheen1
    @saleheen1 11 дней назад

    I search a problem, I don't it from Greg Hogg, I become sad.
    I don't want to watch it from anyone else. 😬