You sell sweets door to door before Diwali along one street. The list nums holds how many rupees of sweets each house will buy. But neighbours talk: if you sell to two houses that stand next to each other, the second customer cancels the order.
Choose which houses to sell to so that no two chosen houses are next to each other. Return the largest total amount you can earn.
Examples
Example 1:
Input: nums = [5,1,1,6]
Output: 11
Explanation: Sell to house 1 (5 rupees) and house 4 (6 rupees). Total = 5 + 6 = 11.
Example 2:
Input: nums = [3,10,3,1,2]
Output: 12
Explanation: Sell to house 2 (10), and house 5 (2). Total = 12. Houses 2 and 4 would give 11, so 12 is better.