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

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ต.ค. 2024

ความคิดเห็น • 22

  • @GregHogg
    @GregHogg  2 หลายเดือนก่อน +1

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

    • @kapilrules
      @kapilrules หลายเดือนก่อน

      @GregHogg you are awesome

  • @nicolofretti8601
    @nicolofretti8601 26 วันที่ผ่านมา

    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  26 วันที่ผ่านมา

      Thank you for such a kind comment 🙏🏼

  • @anshpradhan1954
    @anshpradhan1954 2 หลายเดือนก่อน +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  2 หลายเดือนก่อน

      Leetcode is definitely easiest in Python lol

  • @KaushikkrSarma
    @KaushikkrSarma 2 หลายเดือนก่อน

    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  2 หลายเดือนก่อน

      That's amazing! Very glad to hear it

  • @leonardodanelutti4490
    @leonardodanelutti4490 7 ชั่วโมงที่ผ่านมา +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 7 ชั่วโมงที่ผ่านมา +1

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

  • @amazingmanish
    @amazingmanish 5 หลายเดือนก่อน

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

    • @GregHogg
      @GregHogg  5 หลายเดือนก่อน +1

      Oh awesome! Thanks a bunch!

  • @anirudd01
    @anirudd01 5 หลายเดือนก่อน

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

    • @GregHogg
      @GregHogg  5 หลายเดือนก่อน

      Super super glad to hear it. Thanks a ton 😊

  • @SimpChimp-zl3ns
    @SimpChimp-zl3ns 5 วันที่ผ่านมา

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

  • @GarouNguyen
    @GarouNguyen 3 หลายเดือนก่อน

    Bro you nail djt I understand, thank you bro

  • @PhonesUnboxing
    @PhonesUnboxing 3 หลายเดือนก่อน

    Can use BFS as well

  • @marknuggets
    @marknuggets 5 หลายเดือนก่อน +1

    Lol amazing quality

    • @GregHogg
      @GregHogg  5 หลายเดือนก่อน +2

      Thank you so much!

  • @antonmykhailovskyi447
    @antonmykhailovskyi447 5 หลายเดือนก่อน

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

    • @GregHogg
      @GregHogg  5 หลายเดือนก่อน

      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 5 หลายเดือนก่อน

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