You are a robber planning to loot houses along a street, but here the houses are arranged in a circle, so the first and last houses are adjacent. Each house holds nums[i] dollars, and robbing two directly adjacent houses on the same night triggers the alarm.
Return the maximum amount of money you can rob without alerting the police.
Input / output
nums: int[]int (maximum loot)Examples
nums = [2,3,2] returns 3 because houses 0 and 2 are adjacent, so you can only take the single house holding 3.nums = [1,2,3,1] returns 4 by robbing houses 0 and 2 (1 + 3).nums = [0] returns 0.Constraints
1 <= nums.length <= 1000 <= nums[i] <= 1000Follow-up The only wrinkle versus the linear House Robber is the wrap-around adjacency. Can you reuse the linear solution as a black box instead of writing a new circular recurrence?