As reported: Amazon SDE-2 loop (Hyderabad, July 2025), round 4 — a virtual bar raiser with Leadership Principles and two coding questions; this was the first.
Houses stand in a circle: the first house is next to the last. nums[i] is the money in house i. Robbing two adjacent houses triggers the alarm. Return the most money you can rob.
This is LeetCode 213 — House Robber II.
Example 1
nums = [2,3,2]
Output: 3 houses 0 and 2 are adjacent in the circle
Example 2
nums = [1,2,3,1]
Output: 4 rob houses 0 and 2
Constraints: 1 ≤ nums.length ≤ 100; 0 ≤ nums[i] ≤ 1000.
Code runner format: one line: nums as a JSON array (LeetCode's test-case format). Implement rob(nums); the harness prints the result.