FastPrepMaximum Reachable Value Within a Step Budget
Problems/Maximum Reachable Value Within a Step Budget

Maximum Reachable Value Within a Step Budget

Adobe logoAdobe● EasyINTERNNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Adobe online assessment for interns and new grads. The report asks for the highest value reached while changing x to y with at most z moves of +1 or -1. It returns -1 if the target cannot be reached. Its integer inputs range from 1 to 10^8. Our version keeps the wider limits and the 64-bit function signature listed below, and it also allows inputs of zero. Our version is about 99% the same as the reported question.

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 = 3y = 4steps = 5return = 6

The walk 3,4,5,6,5,4 uses 5 steps, ends at 4, and reaches coordinate 6.

Example 2

x = 2y = 8steps = 4return = -1

Reaching 8 from 2 requires at least 6 steps, so the budget is insufficient.

Example 3

x = 10y = 4steps = 8return = 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.

Example 4

x = 4y = 4steps = 4return = 6

The walk 4,5,6,5,4 uses 4 steps, returns to 4, and reaches 6. Reaching 7 and returning would require 6 steps. Using 0 or 2 steps would instead give maximum coordinates 4 or 5.

Example 5

x = 8y = 5steps = 3return = 8

The walk 8,7,6,5 uses all 3 steps and reaches the target. Its highest coordinate is the starting coordinate 8; there is no budget for a detour.

Example 6

x = 4y = 4steps = 6return = 7

The walk 4,5,6,7,6,5,4 uses 6 steps, returns to 4, and reaches 7. Reaching 8 and returning would require 8 steps.

Constraints

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

Source note: Original OA task panels and author-written examples for the bounded walk. The practice uses the wider input bounds listed in Constraints.

More Adobe Online Assessment questions

  • Base Unit ConversionsOA · Seen Nov 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Top-Funded Villages and ProjectsOA · Seen Aug 2026
  • Count Parent Nodes With a Target SumOA · Seen Aug 2026
  • Largest Binary Number by ConcatenationOA · Seen Aug 2026
  • Count Events by CategoryOA · Seen Aug 2026
  • Graph M-ColoringOA · Seen Aug 2026
  • Hall of Shifting TilesOA · Seen Aug 2026
  • K-th Ancestor Subtree Preorder QueryOA · Seen Aug 2026
  • Maze ReachabilityOA · Seen Aug 2026

Similar questions at other companies

  • Summarize Taxi Drivers and RidesBoston Consulting Group · OABoston Consulting Group interview questions
  • Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Counting Cows by Their LegsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Server InvestmentRippling · OARippling interview questions
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Identification Number Check DigitAbridge · OAAbridge interview questions
  • Count Substrings With Identical CharactersVirtu Financial · OAVirtu Financial interview questions
  • Next Pascal Row CoefficientIntuit · OAIntuit interview questions
  • Digit-Sum Sequence Join PointOpenAI · OAOpenAI interview questions

Adobe interview experiences

  • Adobe New Grad OA: Unit Conversion and Code Review: 1 Experience
  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
  • Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public long maximumReachableValue(long x, long y, long steps) {
        // Write your code here.
    }
}
Checking account…