MEDIUMasked at 4 companies

Rank Teams by Votes

A medium-tier problem at 59% community acceptance, tagged with Array, Hash Table, String. Reported in interviews at Atlassian and 3 others.

Founder's read

You're given a list of votes where each vote is a string of characters. You need to rank teams (characters) by their vote counts, with ties broken by lexicographic order. Atlassian, Coursera, eBay, and Flipkart have all asked this. The 59% acceptance rate tells you it's not trivial: most candidates overthink the sort logic or mess up the tie-breaking rule. The trick isn't the counting part, it's getting the custom comparator right on the first try.

Companies asking
4
Difficulty
MEDIUM
Acceptance
59%

Companies that ask "Rank Teams by Votes"

If this hits your live OA

Rank Teams by Votes is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code.

Get StealthCoder
What this means

The core move is counting votes per team using a hash table, then sorting by (count descending, then lexicographic ascending). The trap: candidates write the sort correctly in isolation but fail when their language's sort API doesn't match their mental model of the tie-breaker. Python's sorted() with a custom key works cleanly; Java and C++ require careful comparator logic. When you hit this live in the assessment and your first sort attempt returns teams in the wrong order, StealthCoder surfaces a working solution instantly, invisible to the proctor. That hedge matters because the problem statement is simple enough to make you confident you got it right when you didn't.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Rank Teams by Votes recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Rank Teams by Votes interview FAQ

Is this really a medium or harder than it looks?+

It's a medium that feels like an easy until you code it. Counting is trivial. The real work is the comparator. If your language makes custom sorting clunky (Java), you spend time debugging the comparison logic instead of moving forward. That's the gotcha.

What's the most common mistake candidates make?+

Reversing the sort order for counts but forgetting that ties go alphabetically forward. Or sorting both counts and names in descending order. The problem statement is clear about tie-breaking only by name, but candidates rush and apply descending to both.

Do I need to know anything about hash tables for this?+

Only that you use one to count. The heavy lifting is the Sorting step, not the Hash Table. A simple dict or map gives you O(n) counting, then sort dominates at O(n log n). No fancy hash logic needed.

How often is this still asked by top companies?+

Atlassian, Coursera, eBay, and Flipkart have all reported it. That's four solid names. It's not as common as two-sum, but it's stable enough that ignoring it in prep is risky if you're targeting those companies.

What's the time and space complexity I should know?+

O(n log n) for the sort, O(n) for the hash table count, so O(n log n) overall. Space is O(n) for the hash table and output. Nothing exotic, but the linear counting phase makes it clean compared to some sorting problems.

Want the actual problem statement? View "Rank Teams by Votes" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.