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...
Master Data Structures & Algorithms For FREE at AlgoMap.io!
Big thanks for taking the time to make this video! You broke down the concepts of DP in a helpful way :)
Glad to hear it!
You're amazing at explaining things :D Big thanks for the content.
Man I was having such a hard time figuring this out
Thank you so much for this video man
You're very welcome!
... as always... impressive and absolutely well explained! 💪🏻👍🏻
Awesome, very glad to hear it :)
Nice to see both the Top down and Bottom up solutions.
I think bottom up solution is more intuitive in this case.
I think so too :)
this was such a good explanaition but im still lost lmfao
same
Great explantation, how long have you been coding?
Thank you! Several years
By looking to all these comments it seems like im the only one who didn't understand
Which software are you using to draw the solution ? Is this OneNote?
Miro
Impressive Greg!
Thank you!
I want to learn dsa in python so how can I start please guide me
I have a full playlist of problem solutions
Why can’t you just take the max of the sum of the even and odd indices?
Because skipping two houses can be good, a la [10, 5, 5, 10] where 20 is the best score
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?
yes, this algorithm still works, try it.
Line number 8-11 is unnecessary.
Your explanation 🫡🫡🫡
Please tell me freshman computer science will be this interesting 😅
yep, more interesting than this lol. Sometimes it's so interesting, you just want to smash your computer
Dude you made it complicated 😅. It’s an easy problem
So impressive! Thanks for providing multiple solutions for DP
You're welcome 🙂🙂
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.
We start from n-1 in the top down solution and start from 0 in the bottom up solution