Max Area of Island - Leetcode 695 - Graphs (Python)

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

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

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

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

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

      @GregHogg you are awesome

  • @nicolofretti8601
    @nicolofretti8601 Месяц назад +1

    Thank you, Greg! I love your teaching approach. You start by explaining problems from a high-level perspective, helping us understand the logic behind the solution. 🧠 Then, you dive deep into the source code. 💻 Your work is truly appreciated :)

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

      Thank you for such a kind comment 🙏🏼

  • @anshpradhan1954
    @anshpradhan1954 3 месяца назад +2

    Greg, I must say, Im in love with python cuz of you, thank you, python being on of those languages, which is easy to learn BUT hard to master, you did a pretty good job at convincing me to use it for solving leetcode problems, leetcode seems easier with python idk why 😂😂😂

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

      Leetcode is definitely easiest in Python lol

  • @laharianegama5004
    @laharianegama5004 14 дней назад

    Greg, thank you for making such content. This is a game changer for me.

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

    Your explanation is really good , your website is awesome as well . I could finally do a graph problem on my own , all thanks to you greg , keep going 👍

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

      That's amazing! Very glad to hear it

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

    I thought of the same solution but forgot that it's actually DFS. Nice explanation. Good work buddy.

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

      Oh awesome! Thanks a bunch!

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

    This was amazing, you made it look easy , but yea it is easy now thanks to you, keep up the good work

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

      Super super glad to hear it. Thanks a ton 😊

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

    Bro you nail djt I understand, thank you bro

  • @SimpChimp-zl3ns
    @SimpChimp-zl3ns Месяц назад

    3:24 that siren got me looking thru the my window 😅😂

  • @leonardodanelutti4490
    @leonardodanelutti4490 29 дней назад +1

    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

    • @leonardodanelutti4490
      @leonardodanelutti4490 29 дней назад +1

      This should have a time complexity of theta(m*n), space complexity of theta(Min{m,n}) and be much faster in practice

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

    Can use BFS as well

  • @marknuggets
    @marknuggets 6 месяцев назад +1

    Lol amazing quality

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

      Thank you so much!

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

    However, you are doing backtracking here and not dfs, aren`t you? Or am I missing something?

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

      There's an absurdly tiny difference between backtracking and DFS. Technically this is dfs because when we make a land (1) a water (0), we never undo (backtrack) this modification.

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

      @@GregHogg got it, thank you! I'm kind of new in this sphere, so I was a bit confused