MEDIUMasked at 2 companies

Design Underground System

A medium-tier problem at 74% community acceptance, tagged with Hash Table, String, Design. Reported in interviews at Bloomberg and 1 others.

Founder's read

Design Underground System is a medium-difficulty system design problem that Bloomberg and Goldman Sachs both ask. You're building a data structure that tracks passenger journeys on a subway: record when someone enters at one station and exits at another, then query average travel time between any two stations. It looks simple until you realize you need sub-second query times with minimal memory overhead. The trick is choosing the right hash table structure upfront, because a clumsy design will TLE or fail on large datasets. If this hits your live OA and you freeze on the schema, StealthCoder surfaces a working solution instantly.

Companies asking
2
Difficulty
MEDIUM
Acceptance
74%

Companies that ask "Design Underground System"

If this hits your live OA

Design Underground System 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. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

Most candidates start by storing raw trip objects and recalculating averages on every query. That approach works on small test cases but dies at scale. The optimal solution uses a Hash Table keyed by station pair (entry station, exit station) to store a list of travel times, plus a running sum to compute average in O(1). You also need a separate hash table to track in-flight passengers by ID. The real gotcha is the station-pair key: some people use strings (risky for collisions), others use tuples (language-dependent). Goldman Sachs and Bloomberg both grade heavily on clean separation of concerns and avoiding redundant recalculation. This is a design problem, not an algorithm problem, so your data structure choices matter more than your sorting speed. If you lock in the wrong schema during the live assessment and hit a wall, StealthCoder hands you the exact structure in seconds.

Pattern tags

The honest play

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

Design Underground System 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. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Design Underground System interview FAQ

Is this really a medium problem, or does it just feel easy in practice?+

It's genuinely medium. The logic is straightforward, but candidates often botch the hash table structure, use inefficient key formats, or recalculate averages on every query. Bloomberg and Goldman Sachs test whether you think about scale and design tradeoffs upfront, not just whether the code runs.

What's the most common mistake on this problem?+

Storing trip objects in a list and summing times on every query. It passes small cases but fails large ones. The winning move is pre-computing and storing the sum alongside the trip list so average is O(1). Hash table choice for the station pair key is the second pitfall.

Does Goldman Sachs or Bloomberg care about language-specific optimizations here?+

They care about big-O guarantees and clean design, not micro-optimizations. Both companies accept Python, Java, and C++. Your bottleneck is logic, not language. A well-designed solution works everywhere.

How does this relate to the Hash Table topic if the solution is mostly design?+

Hash Table is the backbone. You need two hashes: one for the station pair to store trip times and sum, another for in-flight passengers. The entire problem is choosing the right hash structure and keys. Poor hash design kills performance.

Will this problem come up in a real interview with Bloomberg or Goldman Sachs?+

Frequently in systems and OA rounds. Both companies ask it regularly enough that it's worth drilling. The 74% acceptance rate suggests it's a tiebreaker problem, not a gatekeeper.

Want the actual problem statement? View "Design Underground System" 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.