House Robber - Leetcode 198 - Dynamic Programming (Python)

Поділитися
Вставка
  • Опубліковано 27 вер 2024
  • Master Data Structures & Algorithms for FREE at AlgoMap.io/
    Code solutions in Python, Java, C++ and JS for this can be found at my GitHub repo here: github.com/gah...
    Complete DSA Pathway Zero to Hero: • Data Structures & Algo...
    Please check my playlists for free DSA problem solutions:
    • Fundamental DSA Theory
    • Array & String Questions
    • 2 Pointers Questions
    • Sliding Window Questions
    • Binary Search Questions
    • Stack Questions
    • Linked List Questions
    • Tree Questions
    • Heap Questions
    • Recursive Backtracking...
    • Graph Questions
    • Dynamic Programming (D...
    My Data Science & ML UA-cam Playlist: • Greg's Path to Become ...
    Learn Python and Data Science FASTER at mlnow.ai :)
    Support the content: / @greghogg
    Follow me on Instagram: / greghogg5
    Connect with me on LinkedIn: / greghogg
    Follow me on TikTok: / greghogg5
    Coursera Plus: imp.i384100.ne...
    My Favorite Courses:
    Data Structures & Algorithms:
    - UCalifornia San Diego DSA: imp.i384100.ne...
    - Stanford Algorithms: imp.i384100.ne...
    - Python Data Structures: imp.i384100.ne...
    - Meta Coding Interview Prep: imp.i384100.ne...
    Python:
    - UMichigan Python for Everybody: imp.i384100.ne...
    - Python Mastery from MLNOW.ai: mlnow.ai/cours...
    - Google IT Automation w/ Python: imp.i384100.ne...
    Web Dev / Full Stack:
    - Meta Front-End Developer: imp.i384100.ne...
    - IBM Full Stack Developer: imp.i384100.ne...
    - Meta Back-End Developer: imp.i384100.ne...
    - John Hopkins HTML, CSS & JS: imp.i384100.ne...
    - IBM DevOps: imp.i384100.ne...
    Cloud Development:
    - AWS Fundamentals: imp.i384100.ne...
    - GCP Cloud Engineer: imp.i384100.ne...
    - Microsoft Azure Fundamentals: imp.i384100.ne...
    Game Development:
    - Michigan State Unity Development: imp.i384100.ne...
    - UColorado C++ for Unreal Engine: www.coursera.o...
    SQL & Data Science:
    - SQL by MLNOW.ai: mlnow.ai/cours...
    - Python for Data Science by MLNOW.ai: mlnow.ai/cours...
    - Google Data Analytics: imp.i384100.ne...
    - IBM Data Science: imp.i384100.ne...
    - IBM Data Engineer: imp.i384100.ne...
    Machine Learning & AI:
    - ML Mastery at MLNOW.ai: mlnow.ai/cours...
    - ML w/ Andrew Ng: www.coursera.o...
    - Deep Learning w/ Andrew Ng: imp.i384100.ne...

КОМЕНТАРІ • 33

  • @GregHogg
    @GregHogg  2 місяці тому

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

  • @calebghirmai6478
    @calebghirmai6478 2 місяці тому +3

    Big thanks for taking the time to make this video! You broke down the concepts of DP in a helpful way :)

    • @GregHogg
      @GregHogg  Місяць тому

      Glad to hear it!

  • @Azyrys
    @Azyrys 3 місяці тому +2

    You're amazing at explaining things :D Big thanks for the content.

  • @mairahmed6196
    @mairahmed6196 8 днів тому

    Man I was having such a hard time figuring this out
    Thank you so much for this video man

    • @GregHogg
      @GregHogg  8 днів тому

      You're very welcome!

  • @denizmetzger7410
    @denizmetzger7410 3 місяці тому +1

    ... as always... impressive and absolutely well explained! 💪🏻👍🏻

    • @GregHogg
      @GregHogg  3 місяці тому

      Awesome, very glad to hear it :)

  • @christianjt7018
    @christianjt7018 Місяць тому

    Nice to see both the Top down and Bottom up solutions.
    I think bottom up solution is more intuitive in this case.

    • @GregHogg
      @GregHogg  Місяць тому

      I think so too :)

  • @nathanxie1194
    @nathanxie1194 2 місяці тому +1

    this was such a good explanaition but im still lost lmfao

  • @NikerB
    @NikerB 3 місяці тому

    Great explantation, how long have you been coding?

    • @GregHogg
      @GregHogg  3 місяці тому

      Thank you! Several years

  • @a4addel
    @a4addel 24 дні тому

    By looking to all these comments it seems like im the only one who didn't understand

  • @rajendrabrahmbhatt2585
    @rajendrabrahmbhatt2585 3 місяці тому

    Which software are you using to draw the solution ? Is this OneNote?

  • @shakilahmed4647
    @shakilahmed4647 3 місяці тому

    Impressive Greg!

  • @codewithtm544
    @codewithtm544 3 місяці тому

    I want to learn dsa in python so how can I start please guide me

    • @GregHogg
      @GregHogg  3 місяці тому

      I have a full playlist of problem solutions

  • @rajgarimella626
    @rajgarimella626 3 місяці тому

    Why can’t you just take the max of the sum of the even and odd indices?

    • @mortsaidmort
      @mortsaidmort 3 місяці тому +1

      Because skipping two houses can be good, a la [10, 5, 5, 10] where 20 is the best score

  • @legobuildingsrewiew7538
    @legobuildingsrewiew7538 3 місяці тому

    What about cases where the end of the array had something like 100 or another array where skipping two houses would be optimal? This algorithm doesnt seem to work here right?

    • @christianjt7018
      @christianjt7018 Місяць тому

      yes, this algorithm still works, try it.

  • @yashpokar
    @yashpokar Місяць тому

    Line number 8-11 is unnecessary.
    Your explanation 🫡🫡🫡

  • @jakewood1942
    @jakewood1942 3 місяці тому

    Please tell me freshman computer science will be this interesting 😅

    • @TuanNguyen-ed9rb
      @TuanNguyen-ed9rb Місяць тому

      yep, more interesting than this lol. Sometimes it's so interesting, you just want to smash your computer

  • @Fam-m4i
    @Fam-m4i 2 місяці тому +1

    Dude you made it complicated 😅. It’s an easy problem

  • @SHIHJUIheh
    @SHIHJUIheh Місяць тому

    So impressive! Thanks for providing multiple solutions for DP

    • @GregHogg
      @GregHogg  Місяць тому

      You're welcome 🙂🙂

  • @xingyuxiang1637
    @xingyuxiang1637 3 місяці тому

    You can start from index 0, and for each associated element, select and unselect. If selected, move 2 steps. If unselected, move to the next step. In this way, you do not need to reverse or start from n - 1.

    • @GregHogg
      @GregHogg  3 місяці тому

      We start from n-1 in the top down solution and start from 0 in the bottom up solution