Reported September 2026
Capital Onearray

Circular High-Low Pattern

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

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

The Capital One OA reported in September 2026 hands you an even-length circular array and asks one thing: does every element sit strictly above or strictly below both neighbors, with roles flipping all the way around the circle? Examples like [1,3,2,4] pass and [1,2,3,4] fails. It's an array scan, not a hard algorithm, but the wraparound and the equal-values rule trip people up when they're rushing. If you blank on the edge handling, StealthCoder runs invisibly during the live assessment and gives you a working solution as a safety net.

The problem

Given an even-length circular integer array values, return whether its elements strictly alternate between local lows and local highs.
For every index i, compare values[i] with its two circular neighbors. Every element must be strictly greater than both neighbors or strictly less than both neighbors, and adjacent elements must have opposite roles. Equal adjacent values are not allowed.

Function
isCircularHighLow(values: int[]) → boolean

Examples
Example 1
values = [1,3,2,4]
return = true
Reading around the circle gives low, high, low, high.
Example 2
values = [1,2,3,4]
return = false
Values 2 and 3 are neither alternating circular extrema.

Constraints
4 <= values.length <= 100000.
values.length is even.
-1000000000 <= values[i] <= 1000000000.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is that you only need one linear pass with modular indexing. For each i, get prev = values[(i-1+n)%n] and next = values[(i+1)%n]. Check that values[i] is strictly greater than both or strictly less than both. If neither holds, return false. Equal neighbors fail automatically because the comparisons are strict. Opposite roles for adjacent elements follow from the local checks, since a strict high beside a strict low can't be the same type. Still, you can enforce alternation explicitly by fixing the role of index 0 and requiring index parity to match. The common pitfalls are forgetting the wraparound at index 0 and n-1, and using non-strict comparisons. Time is O(n), space is O(1). Values reach 1e9, so comparisons are safe in 32-bit ints. If the wraparound logic slips under pressure, StealthCoder is there as a hedge during the live OA.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Circular High-Low Pattern 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 passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Capital One reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Circular High-Low Pattern FAQ

How hard is the Circular High-Low Pattern problem really?+

Easy. It's a single pass over the array with modular indexing. The difficulty is in the details: wraparound at both ends, strict comparisons, and equal neighbors. If you read the statement carefully, you can solve it in a few minutes.

What's the trick to solving it?+

Use (i-1+n)%n and (i+1)%n to get circular neighbors. For each element, check it's strictly greater than both or strictly less than both. Any failure returns false. Strictness handles equal adjacent values with no extra code.

Do I need to check that roles alternate separately?+

Not strictly. If every element is a strict local extreme, adjacent elements must be opposite types. A high next to another high would violate the strict comparison. Checking parity against index 0's role is an optional extra safety check.

What edge cases should I test?+

Test equal adjacent values like [2,2,1,3], the wraparound pair at indices 0 and n-1, and the minimum length of 4. Also try negative numbers and values near 1e9. A case where the middle alternates but the wrap breaks is the one people miss.

How do I prepare in 48 hours for a Capital One OA like this?+

Practice circular array indexing and neighbor-comparison scans, plus basic array and simulation problems. Write the modulo logic by hand until it's automatic. Then do a couple of timed easy-to-medium array problems so the reading and edge-case checking feel routine.

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

OA at Capital One?
Invisible during screen share
Get it