```
class Solution(object):
def rob(self, nums):
if not nums:
return 0
dp = [ 0 for i in xrange(len(nums)) ]
for i in xrange(len(nums)):
dp[i] = nums[0] if i == 0 else ( max(nums[0], nums[1]) if i == 1 else max(dp[i - 1], dp[i - 2] + nums[i]) )
return dp[-1]
```