Given an array nums where nums[i] is the money in the ith house, return the maximum amount you can rob without robbing two adjacent houses. This is a direct 0/1 decision DP problem on a line.
nums = money in each house
maximum amount that can be robbed
Example 1:
Input:
nums = [1,2,3,1]
Output:
4
Explanation:
Rob houses 1 and 3 for 1 + 3 = 4.
Example 2:
Input:
nums = [2,7,9,3,1]
Output:
12
Explanation:
The best valid plan is 2 + 9 + 1 = 12.