You sell sweets door to door before Diwali, but now the houses stand around a circular park. The list nums holds how many rupees of sweets each house will buy. The first house and the last house are also neighbours.
Neighbours talk: if you sell to two houses that are next to each other, the second customer cancels the order. Choose houses so that no two chosen houses are neighbours, and return the largest total amount you can earn.
Examples
Example 1:
Input: nums = [4,1,4]
Output: 4
Explanation: House 1 and house 3 are neighbours in the circle, so you cannot take both. The best is one house: 4.
Example 2:
Input: nums = [2,9,3,8]
Output: 17
Explanation: Sell to house 2 (9) and house 4 (8). They are not neighbours. Total = 17.
Example 3:
Input: nums = [7,2,3]
Output: 7
Explanation: The best is house 1 alone (7), because house 3 is its neighbour in the circle.