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.
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?
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.
... as always... impressive and absolutely well explained! 💪🏻👍🏻
Awesome, very glad to hear it :)
So impressive! Thanks for providing multiple solutions for DP
You're welcome 🙂🙂
this was such a good explanaition but im still lost lmfao
same
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 :)
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
Great explantation, how long have you been coding?
Thank you! Several years
Impressive Greg!
Thank you!
Which software are you using to draw the solution ? Is this OneNote?
Miro
Dude you made it complicated 😅. It’s an easy problem
I want to learn dsa in python so how can I start please guide me
I have a full playlist of problem solutions
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.
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
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
By looking to all these comments it seems like im the only one who didn't understand