House Robber II

Medium · Dynamic Programming · about 15 minutes

Asked at Bloomberg, Amazon, Google, Meta, Microsoft.

Houses are arranged in a circle, so the first and last houses are neighbors. nums[i] is the money in house i, and you can't rob two adjacent houses. Return the most money you can rob.

Related guides