FreeCareerPath
Build the PrimitiveMedium

House Robber II

Write `rob_circular(nums)` with the same rule as House Robber, except the first and last houses are adjacent. rob_circular([2,3,2]) -> 3 (cannot take both 2s) The circle only forbids one combination: first and last together. So run the linear solution twice — once dropping the last house, once dropping the first — and take the better. A single house is the edge case, since both runs would drop it.

What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.

Log in to start this session

Timed sessions and your results for "House Robber II" are saved to your account — logging in takes a few seconds.

House Robber II — FreeCareerPath