House Robber II

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

Constraints

  • 1 <= nums.length <= 100
  • 0 <= nums[i] <= 1000
Saving… · 2 lines
class Solution:
def houseRobberII(self, nums: List[int]) -> int:
Console

Click Run to execute sample tests.