Reported December 2024
Uberhash table

Command Frequency Counter

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

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

You've got an Uber OA in your inbox with a hash-table problem: Command Frequency Counter. This one landed in December 2024, and it's testing whether you can track and aggregate data without overthinking it. The pattern is straightforward, but the implementation details trip candidates up. You need to count command occurrences, aggregate them efficiently, and return results in a format the system expects. StealthCoder can pull you out if you blank on the iteration or return format.

Pattern and pitfall

The core task is counting occurrences of commands, which screams hash-table or dictionary. You iterate through a list of commands, increment a counter for each unique command, and return the aggregated counts. The trick isn't the counting itself, it's the return format: sometimes it's a sorted list, sometimes it's a map, sometimes it's ordered by frequency. The common miss is assuming the naive approach works without checking edge cases like empty input, duplicate handling, or output ordering. StealthCoder serves as your safety net during the live assessment if you get stuck on the output contract or iteration logic.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Command Frequency Counter 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. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

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

⏵ The honest play

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

Uber reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Command Frequency Counter FAQ

How hard is this really for Uber's bar?+

Easy to medium. It's not a trick problem. The difficulty comes from getting the output format exactly right, not the algorithm. If you've done basic hash-table problems before, the logic is familiar. The time pressure matters more than the conceptual lift.

What's the main pitfall candidates hit?+

Forgetting to handle the output format correctly. They solve the counting part fine, then fail because they return the wrong data structure or the wrong order. Read the problem's return specification three times before coding.

Do I need to sort the output?+

Maybe. The problem statement will specify. If it asks for frequency order, you'll need to sort by count. If it's just a map, you don't. Don't assume. The problem text tells you everything.

What if the input is empty or has duplicates?+

Empty input should return an empty result (empty map or empty list, depending on spec). Duplicates are the point of the problem, so the hash-table naturally handles them. Your counter increments for each occurrence.

Can I solve this in one pass?+

Yes. Single loop over the commands, increment counts in the hash-table. If you need sorted output, you'll do a second pass to sort. That's still O(n log n) at worst, which is fine for Uber's typical constraints.

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

OA at Uber?
Invisible during screen share
Get it