You can just skip 1 house, or 2 houses to get the maximum money.

That means `maximum_money(i_th) = max(maximum_money(i-2th), maximum_money(i-3th))`

.

```
class Solution(object):
def rob(self, nums):
leng = len(nums)
if leng == 0:
return 0
elif leng == 1:
return nums[0]
elif leng == 2:
return max(nums[0], nums[1])
money = [0] * leng
# set initial state
money[0] = nums[0]
money[1] = nums[1]
money[2] = nums[0] + nums[2]
# set the bigger one
for i in range(3, leng):
money[i] = max(money[i-2] + nums[i], money[i-3] + nums[i])
return max(money[leng-1], money[leng-2])
```