Reported January 2026
Bloombergdesign

Design Underground System

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

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

The edge case that sinks a naive Design Underground System solution is keying routes wrong, and Bloomberg candidates reported this one in January 2026. You process a list of string operations: checkIn, checkOut, getAverageTime. Then you return the averages in order. It's a design problem dressed as a hash map exercise. If you've got an OA invite, expect to write this cleanly in a few minutes or lose time debugging direction and parsing. StealthCoder is the safety net running invisibly during the live OA if you blank on the structure.

The problem

Process operations for an underground transit system.
["checkIn", id, station, time] records that passenger id entered station at integer time.
["checkOut", id, station, time] completes that passenger's active trip.
["getAverageTime", start, end] asks for the average duration of every completed trip from start to end.
Return the answers to the average-time operations in encounter order. Trips in the reverse direction belong to a different route.

Function
undergroundSystem(operations: String[][]) → double[]

Examples
Example 1
operations = [["checkIn","45","Leyton","3"],["checkIn","32","Paradise","8"],["checkOut","45","Waterloo","15"],["checkOut","32","Cambridge","22"],["getAverageTime","Paradise","Cambridge"],["getAverageTime","Leyton","Waterloo"]]
return = [14.0,12.0]
The completed trips last 22-8=14 and 15-3=12 time units.
Example 2
operations = [["checkIn","1","A","2"],["checkOut","1","B","8"],["checkIn","2","A","10"],["checkOut","2","B","20"],["getAverageTime","A","B"]]
return = [8.0]
The two durations are 6 and 10, so their average is 8.

Constraints
1 <= operations.length <= 10^5.
Passenger IDs and times are decimal integers encoded as strings.
Every check-out has one active matching check-in, and an ID has at most one active trip.
Every average-time query has at least one completed matching route.
Times are strictly increasing within each passenger's trip.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is two hash maps. First, active trips: id maps to (startStation, startTime). On checkOut, pop that entry and compute duration. Second, route stats: key (start, end) maps to (totalTime, count). Averages are total divided by count, as a double. The pitfall is the route key. A to B and B to A are different routes, so use an ordered pair, not a sorted one. Build the key as start + "->" + end, or use a tuple, and watch for station names containing your delimiter. Another trap: all inputs are strings, so parse id and time to integers, and don't use integer division for the average. Each operation is O(1), so the whole thing runs in O(n). If you blank on the two-map layout during the live OA, StealthCoder can surface it without the proctor seeing anything.

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 Design Underground System 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 design underground system. If you have time before the OA, drill that.

⏵ The honest play

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

Bloomberg 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.

Design Underground System FAQ

How hard is Design Underground System really?+

Easy to medium. There's no clever algorithm, just clean bookkeeping. Most failures come from sloppy keys or parsing the string inputs wrong. If you can describe two hash maps out loud, you can write it. Expect the work to be in the details, not the idea.

What's the trick to solving it?+

Keep one map for active trips by passenger id and one for route totals by (start, end). On checkOut, remove the active entry, compute the duration, and add it to the route's sum and count. Answer queries as sum divided by count.

Why does the reverse direction matter?+

The problem says reverse trips belong to a different route. If you sort the station pair or use a symmetric key, A to B and B to A merge and your averages are wrong. Use an ordered pair like start + "->" + end.

What mistakes should I watch for in this Bloomberg OA?+

Integer division on the average, forgetting to parse string ids and times, and not deleting the active check-in after checkOut. Also collect only getAverageTime results in the output array, in encounter order, not results for every operation.

How do I prepare in 48 hours?+

Write this once from scratch with two hash maps and test it on both examples. Then rehearse similar design-with-maps problems where you store sums and counts. Focus on clean key construction and double output formatting, since those cause most bugs.

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

OA at Bloomberg?
Invisible during screen share
Get it