Houses along a street have money. You can't rob two adjacent houses (security systems will trigger). What's the maximum you can rob?
With nums = [1,2,3,1]:
- Rob house 0 () and house 2 (): total .
- Can't rob 1 and 2 together (adjacent).
- Maximum: .
With nums = [2,7,9,3,1]:
- Rob houses 0, 2, 4: .
- Or rob houses 1, 3: .
- Maximum: .
Constraints: nums.length .