92. Houses in a Circle
Medium
The houses in a neighborhood form a circle, and each house has an amount in valores. You are not allowed to choose two adjacent houses, including the first and the last. Return the maximum possible amount.
Example 1
Input: valores = [2, 3, 2]
Output: 3
Example 2
Input: valores = [1, 2, 3, 1]
Output: 4
Explanation: Choose the second and fourth house.
Constraints
- 0 <= valores.length <= 10^4
- 0 <= valores[i] <= 10^5
Dynamic programmingArrays
Saved in this browser
Caso 1
valores =
[2,3,2]
Expected =
3
Caso 2
valores =
[1,2,3,1]
Expected =
4
Run checks these 2 cases. Submit runs all 6, including hidden ones.