198. House Robber
Practice House Robber for free on NudgeCode: Medium, Dynamic Programming pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
Houses stand in a row and nums[i] is the money in house i. You cannot take from two neighboring houses. Return the most money you can take.
Example
nums = [1,2,3,1] -> 4 (houses 0 and 2)
nums = [2,7,9,3,1] -> 12 (houses 0, 2 and 4)
Constraints
- 1 <= nums.length <= 100
- 0 <= nums[i] <= 400