Reported September 2026
DigitalOceandynamic programming

Maximum Value from Circular Houses

Reported by candidates from DigitalOcean's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live DigitalOcean OA. Under 2s to a working solution.
Founder's read

This DigitalOcean OA, reported in September 2026, looks like a circular puzzle but it's really two linear ones stapled together. It's House Robber II in different clothes. You pick non-adjacent houses around a circle, nonnegative values, and the first and last count as neighbors. If you've seen the linear version, you're 90 percent there. If you haven't, the fix is short and you can hold it in your head. And if you blank on the night, StealthCoder runs invisibly as a safety net while you work through it.

The problem

Houses stand in a circle. The nonnegative integer nums[i] is the value available in house i. Select houses with no two adjacent and return the maximum total value.
The first and last houses are adjacent. For this exercise, assume there is at least one house, selecting none is allowed, and a single house may be selected.

Function
robCircular(nums: int[]) → int

Examples
Example 1
nums = [2,3,2]
return = 3
The two houses worth 2 are adjacent around the circle, so choose the middle house worth 3.
Example 2
nums = [1,2,3,1]
return = 4
Choose values 1 and 3 at indices 0 and 2; they are not adjacent.
Example 3
nums = [5]
return = 5
The only house may be selected.

Constraints
1 <= nums.length <= 10^5.
0 <= nums[i] <= 10^4.
The result fits in a signed 32-bit integer.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick: the circle only breaks at one spot, the first and last houses. You can't take both. So run the standard linear robber DP twice. Once on nums[0..n-2], once on nums[1..n-1]. Return the max of the two. Linear DP is simple: keep prev and curr, and at each house set the new value to max(curr, prev + x). That's O(n) time and O(1) space, which matters with n up to 10^5. The common pitfall is n = 1. Your two slices are both empty, so you return 0 instead of 5. Special-case it and return nums[0]. Another slip is trying to track whether house 0 was picked inside one DP. Two passes is cleaner. Values are nonnegative, so no negative-number traps. If the edge case slips on the live assessment, StealthCoder is the hedge that catches it.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Maximum Value from Circular Houses cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as house robber ii. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass DigitalOcean's OA.

DigitalOcean reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Maximum Value from Circular Houses FAQ

What's the trick in the DigitalOcean circular houses problem?+

Break the circle. House 0 and the last house can't both be chosen, so solve two linear problems: one excluding the last house, one excluding the first. Take the larger result. Each linear pass is the classic pick-or-skip DP using two rolling variables.

How hard is this one really?+

Medium. If you know the linear house robber DP, the circular twist is one extra idea. If you've never seen either, expect to spend your time deriving the recurrence, which is max(skip, prev + current). It's very doable in an OA window.

What edge case breaks most solutions?+

A single house. Splitting into two ranges leaves both empty and returns 0, but the answer is nums[0]. Handle length 1 up front. Length 2 also deserves a quick check: you can only pick one, so you want the max of the two.

Do I need an array for the DP, or can I use O(1) space?+

O(1) works. Each step only needs the best total from the previous house and the one before it. Keep two variables, update them in a loop, and run the loop twice over the two ranges. With n up to 10^5, either approach passes, but rolling variables are cleaner.

How do I prepare for this in 48 hours?+

Write the linear robber DP from memory until it's automatic. Then add the two-range wrapper and test on [2,3,2], [1,2,3,1], and [5]. Also try all zeros and length 2. That covers the pattern and the traps this prompt shows.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with DigitalOcean.

OA at DigitalOcean?
Invisible during screen share
Get it