Reported September 2024
Amazondynamic programming

Get Max Sum

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

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

Amazon's Get Max Sum question hit the OA circuit in September 2024, and it's a straightforward optimization problem that trips up candidates who overthink it. You're looking at an array and need to extract the maximum sum under some constraint, which means the trick is figuring out what's actually allowed and what isn't. Most people blank on whether it's a contiguous subarray, non-adjacent elements, or something tied to indices. StealthCoder reads the exact constraint on screen and surfaces the pattern instantly, so you're never guessing at the problem definition during your live attempt.

Pattern and pitfall

Get Max Sum is a dynamic programming or greedy problem depending on the specific constraint. If it's non-adjacent elements (house robber style), you track the max sum by deciding at each index whether to include the current element or skip it, building up state as you go. If it's a subarray problem, Kadane's algorithm is the play. The gotcha is candidates often misread the constraint, code the wrong approach, and run out of time debugging. The pattern hinges on understanding state transitions: what's the optimal choice at position i given what you know about position i-1. During the OA, if the constraint blurs under pressure, StealthCoder lets you see the exact problem text and the common solutions side by side, turning a panic moment into a clean solve.

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 Get Max Sum 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

⏵ Practice the LeetCode equivalent

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

⏵ The honest play

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

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

Get Max Sum FAQ

Is this a contiguous subarray or non-adjacent elements problem?+

The problem title doesn't specify, which is the trap. Read the constraint in the first 30 seconds of the OA. If it says 'non-adjacent' or 'can't pick consecutive,' it's dynamic programming. If it just says 'subarray,' use Kadane's algorithm. The approach is completely different, so read carefully.

What's the time complexity I need to hit?+

Linear time, one pass. Any O(n) or O(n log n) solution will pass. If you're thinking O(n^2) or worse, you're overcomplicating. The greedy or DP state transition should feel clean and single-pass.

Will I need memoization or a DP table?+

Likely yes, but it can be space-optimized. If you're tracking max sum at each position, you might only need two variables instead of an array. Test your logic on paper with a short example (3-4 elements) before coding.

What's the most common mistake candidates make?+

Misreading the constraint and coding the wrong pattern. The second mistake is forgetting to handle edge cases: empty arrays, single elements, all negative numbers. Test those before submitting.

How much time should I spend on this in the OA?+

15-20 minutes if you read the constraint clearly. If you're stuck after 10 minutes, you misunderstood the problem. Re-read and shift approaches. Don't burn 30 minutes on the wrong pattern.

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

OA at Amazon?
Invisible during screen share
Get it