House Robber II

https://leetcode.com/problems/house-robber-ii/ For a simplified version, see house-robber.

Convert the problem into regular one.

def rob(self, nums: List[int]) -> int:
    if len(nums) == 1:
        return nums[0]
    return max(self.rob_simple(nums[:-1]), self.rob_simple(nums[1:]))
 
def rob_simple(self, nums: List[int]) -> int:
    t1 = 0  # max amt robbed up to the current house
    t2 = 0  # max amt robbed up to before the current house
    for current in nums:
        t1, t2 = max(current + t2, t1), t1
    return t1