Even-Position Monotonicity

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

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

The Boston Consulting Group OA reported in July 2026 looks like a warm-up, and that's exactly why it bites. You pull the even-index values and decide if they strictly increase, strictly decrease, or neither. It's a single-pass array problem. The trap is the equal case and the odd indices, not the algorithm. If you blank on the details mid-assessment, StealthCoder runs invisibly as a safety net and hands you the clean solution. Most people won't need it, but the edge cases are where the points leak.

The problem

Given an array of non-negative integers numbers, inspect the values at zero-based even indices: numbers[0], numbers[2], numbers[4], and so on.
Return "increasing" if these values are in strictly increasing order.
Return "decreasing" if these values are in strictly decreasing order.
Return "none" if these values are not strictly monotonic.
Values at odd indices do not affect the result.
A solution with time complexity not worse than O(numbers.length^2) fits within the execution time limit.

Function
solution(numbers: int[]) → String

Examples
Example 1
numbers = [12,65,15,72,19,72]
return = "increasing"
The values at even indices are 12, 15, and 19. Since 12 < 15 < 19, the result is "increasing".
Example 2
numbers = [12,1,54,5,19,14]
return = "none"
The values at even indices are 12, 54, and 19. They first increase and then decrease, so the result is "none".
Example 3
numbers = [666,17,66,5,6,23]
return = "decreasing"
The values at even indices are 666, 66, and 6. Since 666 > 66 > 6, the result is "decreasing".

Constraints
numbers.length >= 3.
Every numbers[i] is a non-negative integer that fits in a 32-bit signed integer.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is to walk even indices only, stepping by 2, and track two booleans: allIncreasing and allDecreasing. Start both true. For each consecutive pair of even-index values, if next <= prev, allIncreasing becomes false. If next >= prev, allDecreasing becomes false. At the end, return "increasing" if the first flag survives, "decreasing" if the second does, else "none". The pitfall is strictness. Two equal even-index values must kill both flags, so "none" is correct. Don't compare adjacent elements like numbers[i] and numbers[i+1], and don't let odd values leak in. Length is at least 3, so you always have at least two even-index values and both flags can't survive. That removes the empty-case worry. It's O(n) time, O(1) space. If the live OA freezes you on the comparison logic, StealthCoder is your hedge to get unstuck fast.

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 Even-Position Monotonicity 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 Boston Consulting Group's OA.

Boston Consulting Group 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.

Even-Position Monotonicity FAQ

How hard is the Even-Position Monotonicity question really?+

Easy. It's one pass over the array with two flags. The difficulty is purely in reading carefully: strict inequality, even indices only, and returning "none" when values are equal or change direction. Most failures come from sloppy comparisons, not from missing an algorithm.

What's the trick to solving it?+

Step through indices 0, 2, 4 and so on. Keep an increasing flag and a decreasing flag, both starting true. Any pair where next is not greater clears the increasing flag. Any pair where next is not smaller clears the decreasing flag. Return based on which flag survives.

What edge case breaks the naive solution?+

Equal values at consecutive even indices. If you use >= or <= by accident, you'll call it increasing or decreasing when the spec demands strictness. Also watch for odd-index values sneaking into your comparison. Test something like [5,1,5,1,5] and expect "none".

Do I need anything better than O(n)?+

No. The statement says O(n^2) fits, so a single linear pass is far under the limit. You don't need extra arrays either. You can compare each even-index value to the previous one directly and keep constant space.

How do I prepare for this in 48 hours?+

Write it once from scratch and run the three given examples plus a few of your own: equal values, a direction change, and the minimum length of 3. Practice the flag pattern on similar monotonic-check problems. That's enough for a question at this level.

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

OA at Boston Consulting Group?
Invisible during screen share
Get it