思路 如果打劫了第一家,则删去最后一家 否则在最后加上第一家 这样就形成了一个闭环 def rob(nums): size = len(nums) if size == 1: return nums[0] dp = [0