Reported September 2026
Citadeldesign

Exchange BBO and Market-Wide NBBO

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

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

Citadel reported this one in September 2026, and the detail that matters is the tie rule: on a tied market price, pick the lexicographically smallest exchange. The task is order-book bookkeeping. You process ADD, BBO and NBBO commands and return the quote strings in order. It looks like finance flavor, but it's a hash map and heap design problem with string formatting traps. If you blank mid-assessment, StealthCoder runs invisibly as a safety net and reads the problem on screen. Know the shape before you open the invite.

The problem

Process order-book commands. ADD exchange side price quantity adds positive quantity at an integer price on side BID or ASK. Quantities at an identical exchange, side, and price aggregate.
BBO exchange emits that exchange's best bid and best ask as price@quantity,price@quantity. NBBO emits the exchange and level for the market's highest bid and lowest ask as exchange:price@quantity,exchange:price@quantity. Use NA for a missing side. On a tied market price, choose the lexicographically smallest exchange. Return all query outputs in order.

Function
orderBookQuotes(operations: String[]) → String[]

Examples
Example 1
operations = ["ADD X BID 100 3","ADD X ASK 105 2","BBO X","NBBO"]
return = ["100@3,105@2","X:100@3,X:105@2"]
X supplies both local and national best quotes.
Example 2
operations = ["ADD X BID 99 2","ADD Y BID 101 4","ADD X ASK 106 1","ADD Y ASK 104 5","NBBO"]
return = ["Y:101@4,Y:104@5"]
Y has both the highest bid and lowest ask.
Example 3
operations = ["ADD X BID 100 2","ADD X BID 100 7","BBO X","BBO Z"]
return = ["100@9,NA","NA,NA"]
Same-price quantity aggregates; Z has no orders.

Constraints
1 <= operations.length <= 10^5.
Exchange names contain no spaces; prices and quantities are positive integers.
Commands are valid and only ADD, BBO, and NBBO occur.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is keeping best bid and best ask per exchange cheaply, with up to 10^5 operations. Store, per exchange and side, a map of price to aggregated quantity. Since there are only ADD operations and no cancels, a best price only ever improves. So track the best bid and best ask per exchange, updating the quantity when the price matches. No heap is needed. For NBBO, scan the exchanges, or keep a global best with a tiebreak on the smaller name. Pitfalls: a tie at the best price must aggregate only within that exchange, not across exchanges. Output formats differ: BBO has no exchange prefix, NBBO does. Missing sides print NA individually, so you can get 100@9,NA. An unknown exchange in BBO returns NA,NA. If you stall on formatting or the tiebreak, StealthCoder is the hedge during the live OA.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Exchange BBO and Market-Wide NBBO 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. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Citadel reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Exchange BBO and Market-Wide NBBO FAQ

What's the core trick in the Citadel BBO and NBBO problem?+

Because there are no cancels or removals, the best bid only goes up and the best ask only goes down. Keep per-exchange best bid and best ask with aggregated quantity. No heap or sorted structure needed. Each ADD is O(1), and NBBO is a scan over exchanges.

How do I handle ties in NBBO?+

Compare price first. If the price equals the current global best, keep the exchange with the smaller name using normal string comparison. Quantity is the one at that exchange's best level, not a sum across exchanges. Apply the rule separately for the bid and the ask.

What are the easy formatting mistakes?+

Mixing up BBO and NBBO formats. BBO is price@quantity with no exchange. NBBO is exchange:price@quantity. A missing side prints NA alone, so you can see 100@9,NA. A BBO on an exchange with no orders returns NA,NA. Check all three examples against your output.

Is this hard, really?+

It's easy on algorithm and medium on care. There's no deep technique, just clean state and edge cases. The risk is rushing past the aggregation rule or tie rule. Write the three examples as tests before you submit.

How do I prepare in 48 hours for this kind of OA?+

Practice simulation and design-style problems with hash maps and string output. Code a small order book from scratch, then test missing sides, repeated ADDs at the same price, and unknown exchanges. Focus on parsing commands cleanly and on one pass through the operations list.

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

OA at Citadel?
Invisible during screen share
Get it