Get Maximum
Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Amazon's Get Maximum showed up in February 2025 OAs, and it's the kind of problem that looks simple until you realize the trick. You've got maybe 24-72 hours before your assessment, so you need the pattern fast, not a deep dive. The good news: this is a classic optimization problem that follows a predictable structure. StealthCoder sits invisible during your OA and feeds you the solution in real time if you blank on the approach, but you want to walk in knowing the shape of the answer.
Pattern and pitfall
Get Maximum almost always boils down to finding the optimal value across a dataset or sequence using either brute force with pruning or a greedy/dynamic approach. The common trap is overthinking it or missing an early termination condition that cuts runtime in half. Most candidates waste time on the naive path when there's a cleaner pattern buried in the constraints. Study the input size: if it's small (under 10k), brute force with optimization works; if it's large, you need a smarter scan. StealthCoder is your safety net here because if you freeze on whether to iterate left-to-right or track state in a different way, you get unstuck immediately and keep moving.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Get Maximum 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 StealthCoderRelated leaked OAs
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 Maximum FAQ
Is this a DP problem or just greedy iteration?+
Depends on whether the maximum depends on past choices. If it's just picking the best from a list, greedy scan works. If future values change based on prior picks, you need DP. Read the problem statement carefully. Recomputing the maximum after each step is the tell.
What's the most common wrong approach?+
Sorting the input first and losing the original structure or indices. Get Maximum often requires position awareness. Sort only if the problem explicitly asks for it. Many candidates waste 15 minutes on a red herring sort.
How hard is the Amazon version really?+
Easier than it sounds. Amazon's Get Maximum is typically easy-to-medium difficulty. The trick is clarity on what 'maximum' means in context (max value, max count, max difference). Once you answer that, the code flows.
Can I solve this in 48 hours if I haven't seen it?+
Yes. Spend 20 minutes understanding the exact constraints and output requirement. Then code a clean brute force solution. If it times out, optimize. Most OA versions don't have brutal time limits for this class of problem.
Should I track state or just scan and return?+
Start with scan and return. Only add state tracking (arrays, hashmaps, counters) if you need to look back or count occurrences. Simpler code is faster to write and debug under pressure.