r/codinginterview • u/coder_et • Jun 10 '20
Final Round Amazon - House Robber
What's Good Guys,
My friend was just asked this in a final round at Amazon -- you have probably heard of the problem -- but because of his experience, I decided to make a video out of it: https://www.youtube.com/watch?v=c5bG1Fnazqc
When learning DP, too many people (in my opinion) look for some magic bottom-up solution with memoization and try to force a solution.
I have a pretty different mindset. I think we should understand our top-down recursive decisions, add memoization to get the same run time as bottom-up, and then, if we can, turn our recursive decisions into bottom-up decisions (because the bottom-up decisions aren't always immediately clear).
I talk about this framework which considers State, Decisions, and Base Cases a solid amount but if you want a better idea about how you can solve DP problems you have never seen before, watch this video and let me know what you think!