Problem
This time the houses stand in a circle, so the first and last houses are neighbours too. As before, nums[i] is the number of coins in house i, and you may never collect from two adjacent houses. Return the most coins you can collect.
Example 1
- Input
- nums = [2, 3, 2]
- Output
- 3
- Why
- houses 0 and 2 touch, so take house 1
Example 2
- Input
- nums = [1, 2, 3, 1]
- Output
- 4
- Why
- houses 0 and 2
Example 3
- Input
- nums = [1, 2, 3]
- Output
- 3
Constraints
1 <= nums.length <= 1000 <= nums[i] <= 1000