After the last robbery, the thief found a new place to rob, but this time all the houses were in a circle, which meant that the first house and the last house were next to each other. Each house is stocked with a certain amount of money. The only constraint you face is that the neighboring house is connected with an anti-theft system, and the system automatically alarms when two adjacent houses are robbed the same day.
Given a list of nonnegative integers, the amount of money stored in each house is counted, and if you Rob tonight, you can get as much money as you want without triggering the alarm device.
Precautions
The problem is the extension of House robber, but it's just a line turned into a circle.
Sample Example
Give the Nums =[3,6,4]
Return6
, you can't rob.3
And4
The rooms in which they are located, because they are enclosed in a circle, are adjacent.
label Dynamic planningMicrosoft
Problem Solving :
lintcode--011 (House Robbery 2)