| 49 | |
| 50 | """ |
| 51 | class Solution(object): |
| 52 | def rob(self, nums): |
| 53 | """ |
| 54 | :type nums: List[int] |
| 55 | :rtype: int |
| 56 | """ |
| 57 | if not nums: |
| 58 | return 0 |
| 59 | |
| 60 | if len(nums) <= 2: |
| 61 | return max(nums) |
| 62 | |
| 63 | robber = [nums[0], nums[1], nums[2] + nums[0]] |
| 64 | |
| 65 | for i in range(3, len(nums)): |
| 66 | robber.append(max(nums[i] + robber[i-2], nums[i] + robber[i-3])) |
| 67 | |
| 68 | return max(robber) |
nothing calls this directly
no outgoing calls
no test coverage detected