Find Dominance
Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Amazon's November dominance question is a classic array pattern in disguise. You're looking at a problem where one element or subset "dominates" the rest based on frequency, position, or value. The OA won't spell out the rule, so you'll need to recognize it fast. StealthCoder reads the problem statement in real time and flags the exact pattern, so if you blank on the approach during the live test, you've got a safety net.
Pattern and pitfall
Dominance problems typically split into two flavors: either find the element that appears more than n/2 times (majority element, solvable in linear time with Boyer-Moore voting), or find which elements/subarrays "beat" others by some metric. The trick is recognizing that brute force counting will time out on large datasets. The pattern almost always rewards a two-pass approach or a greedy scan that tracks frequency or a running constraint. Most candidates overcomplicate it by sorting or using extra hash tables when a single pass suffices. StealthCoder catches which variant you're actually solving within seconds of reading the problem, so you don't waste time on the wrong algorithm.
StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.
You can drill Find Dominance 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. If you're reading this with an OA window open, you're who this was built for.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Amazon's OA.
Amazon reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Find Dominance FAQ
Is this a majority element problem in disguise?+
Possibly. If the problem asks for an element that appears more than half the time, use Boyer-Moore voting. It's O(n) time, O(1) space, and Amazon loves testing it. If the definition of dominance is different (e.g., index-based or value-based), you'll spot that in the full problem statement.
How do I solve this in under 30 minutes if I've never seen it?+
Read the problem twice. Write the brute force (hash map + count). Test on the example. Then optimize. Most dominance problems go from O(n) space to O(1) with a clever second pass. That's where the interview points live.
Will I need to sort or use a heap?+
Rarely. Dominance problems usually reward a single linear scan or two linear passes. Sorting kills your time budget. If the problem mentions "top k" or "largest," then heap is fair game, but test the constraint first.
What's the most common pitfall on this type of Amazon OA?+
Misreading what "dominance" means in the specific problem. Some versions ask for an index, some ask for a value, some ask for a count. Reread the output format. That one detail flips your entire approach.
Is this problem still being asked by Amazon in 2024?+
Yes. November 2024 confirms it. Array pattern recognition is evergreen for Amazon's OA rounds. It's a low-friction problem that separates hash table fluency from algorithmic awareness.