Reported March 2026
Adobemath

Maximum Reachable Value Within a Step Budget

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

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

The Adobe OA reported in March 2026 looks like a walking simulation, but it's a one-line formula in disguise. You start at x, end at y, get a step budget, and need the highest coordinate you can touch along the way. Candidates burn time simulating walks or binary searching the peak. Don't. The answer comes from counting steps on the way out and the way back. If you've got an OA coming and your mind goes blank on the algebra, StealthCoder runs invisibly during the live assessment and hands you the formula. Know the trick first, though. It takes about two minutes to derive, and the edge cases are the only real risk.

The problem

You start at coordinate x on the integer number line and must finish at coordinate y. Each step moves exactly 1 unit left or right.
You may use at most steps steps. Return the maximum coordinate that can be visited by any valid walk that ends at y. If y cannot be reached within the step budget, return -1.

Function
maximumReachableValue(x: long, y: long, steps: long) → long

Examples
Example 1
x = 3
y = 4
steps = 5
return = 6
The walk 3,4,5,6,5,4 uses 5 steps, ends at 4, and reaches coordinate 6.
Example 2
x = 2
y = 8
steps = 4
return = -1
Reaching 8 from 2 requires at least 6 steps, so the budget is insufficient.
Example 3
x = 10
y = 4
steps = 8
return = 11
Moving from 10 to 4 needs 6 steps. The two extra steps allow a detour to 11 before returning through 10 and continuing to 4.

Constraints
0 <= x <= 10^9.
0 <= y <= 10^9.
0 <= steps <= 2 * 10^9.
The result fits in a signed 64-bit integer.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Let d = |y - x|. If d > steps, return -1. Otherwise pick a peak M that is at least max(x, y). A walk that goes from x up to M and then down to y costs (M - x) + (M - y) = 2M - x - y steps. That has to be at most steps, so M = floor((steps + x + y) / 2). Check example 1: (5+3+4)/2 = 6. Example 3: (8+10+4)/2 = 11. Both match. The same formula covers y below x and y above x, because the peak always sits at or above both endpoints. Pitfalls: forgetting the -1 check, using int instead of 64-bit (steps goes to 2*10^9, so the sum overflows 32 bits), and assuming parity needs special handling. Floor division handles the odd leftover step, since at most steps is allowed. If you blank on the derivation in the live OA, StealthCoder is the hedge.

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 Maximum Reachable Value Within a Step Budget 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 Adobe's OA.

Adobe 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.

Maximum Reachable Value Within a Step Budget FAQ

What's the trick in the Adobe maximum reachable value problem?+

Skip the simulation. Any best walk goes up to a peak M and comes back down to y. That costs 2M - x - y steps. Set that less than or equal to steps and solve for M, giving floor((steps + x + y) / 2). Return -1 first if |y - x| exceeds steps.

How hard is this problem really?+

Easy once you see the formula, deceptive if you don't. The code is about three lines. The difficulty is realizing the walk is just out-and-back, so the peak is determined by total step cost. Candidates who simulate or binary search waste time and risk overflow on the large inputs.

Do I need to handle odd leftover steps or parity?+

No. The budget is at most steps, so you can leave a step unused. Floor division on (steps + x + y) / 2 handles it automatically. Example: x=3, y=4, steps=5 gives 12/2 = 6, and the walk uses exactly 5 steps. If the sum were odd, you'd simply use one fewer step.

What edge cases should I test before submitting?+

Test steps = 0 with x = y, which should return x. Test x = y with a large budget. Test y below x, like example 3. Test an unreachable case like example 2, which returns -1. Also use 64-bit arithmetic, since x + y + steps can reach about 4 * 10^9, past the 32-bit limit.

How do I prepare for this in 48 hours?+

Practice deriving cost formulas for out-and-back movement on a number line, then verify with the three given examples by hand. Spend your time on overflow and boundary checks, not on fancy algorithms. Write the function once in your language of choice, run the examples, and move on to other patterns.

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

OA at Adobe?
Invisible during screen share
Get it