Reported May 2025
Amazonhash table

Get Maximum Count

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 Maximum Count' landed in May 2025 OAs and it's a counting problem dressed up to look harder than it is. You'll see arrays or sequences and need to find which element or value appears most frequently, or maximize some count metric. The trap is overthinking it. Candidates blank on whether to use a hash map, sort, or brute force. StealthCoder reads the exact problem on screen and surfaces the pattern instantly, so you're not guessing under pressure.

Pattern and pitfall

This is fundamentally a counting problem. You'll iterate through your input, track frequencies in a hash table (dictionary), and return the key with the max value, or compare aggregated counts to find a winner. The pitfall: candidates try to sort or use heaps when a single pass plus a max lookup solves it in O(n) time. Watch for edge cases like ties (which max do you return?), empty inputs, or whether the problem asks for the count itself or the element. StealthCoder lets you see the exact wording and constraints without the OA timer crushing you, so you catch those details before you code.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Get Maximum Count 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 for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as majority element. 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 for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Get Maximum Count FAQ

Is this asking for the element with max frequency or the max frequency value itself?+

Read the output spec carefully. Most variants ask for the element. But some ask for the count. Hash map approach works either way: build frequency map, find max, return the key or the value. The OA wording will be explicit.

Do I need to handle ties? What if two elements have the same max count?+

Ties usually aren't mentioned in easy counting problems, but always scan the examples. If ties exist, return the smallest element, largest element, or first occurrence, depending on the problem. Ask yourself what 'natural' ordering makes sense.

Can I sort the array to count, or should I use a hash map?+

Hash map is faster: O(n) time, O(n) space. Sorting works but costs O(n log n). For Amazon, hash map is the expected pattern. Sort only if the problem hints at it or you're running out of mental energy during the live OA.

What if the input is empty or has only one element?+

Empty input usually returns -1 or null. Single element returns that element (count is 1). Always check the problem's base case in the examples or constraints. These edge cases trip up candidates who rush.

How do I prepare in 48 hours if I've never seen this before?+

Memorize the hash map pattern: iterate, count, max. Practice once on a simple array. Don't cram. Sleep well. During the OA, re-read the problem twice before coding. StealthCoder handles the panic moment if you blank on syntax or logic.

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