Problem
Houses along a street hold nums[i] coins each. You may collect from any houses you like, but never from two neighbours, because adjacent alarms are linked. Return the most coins you can collect.
Example 1
- Input
- nums = [1, 2, 3, 1]
- Output
- 4
- Why
- houses 0 and 2
Example 2
- Input
- nums = [2, 7, 9, 3, 1]
- Output
- 12
- Why
- houses 0, 2 and 4
Example 3
- Input
- nums = [2, 1, 1, 2]
- Output
- 4
- Why
- houses 0 and 3
An empty street gives 0.
Constraints
0 <= nums.length <= 1000 <= nums[i] <= 400