House Robber II
You are a robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means the first house is the neighbor of the last one. Adjacent houses have security systems connected and will automatically contact police if two adjacent houses were broken into on the same night. Given an integer array nums representing the amount of money of each house, return the maximum amount of money you can rob tonight without alerting the police.
House Robber II

You are a robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means the first house is the neighbor of the last one. Adjacent houses have security systems connected and will automatically contact police if two adjacent houses were broken into on the same night. Given an integer array nums representing the amount of money of each house, return the maximum amount of money you can rob tonight without alerting the police.

Example 1:
Input: [2,3,2]
Output: 3
Input
arr =[2,3,2]

Houses in circle: first and last are adjacent. Split into two cases.

Houses (Circular - first and last are neighbors)

2

0

3

1

2

2

← connected →
Case 1: Skip Last (0 to 1)
Case 2: Skip First (1 to 2)
Case 1 (skip last)
Case 2 (skip first)
Skipped
Variables
No variables to display
DepthFunction Call
Stack empty
0/10