Quote One Request
Reported by candidates from Millennium's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The data structure this Millennium problem hinges on isn't a structure at all. It's exact decimal arithmetic. Reported in September 2026, Quote One Request looks like a five-line pricing function, and that's the trap. You compute a size-adjusted spread, build a BUY ask or SELL bid, then snap it to a tick grid, ceiling for BUY and floor for SELL. Doubles will quietly give you 99.92499999 instead of 99.925 and wreck the rounding. If you blank on the scaled-integer approach during the live OA, StealthCoder is the safety net running invisibly on your screen.
The problem
Quote one client request around a reference price. First add a size penalty to the supplied half spread: adjustedHalfSpread = halfSpread + penaltyPerUnit * quantity For a BUY request, form the ask price reference + adjustedHalfSpread and round it upward to the next multiple of tickSize. For a SELL request, form the bid price reference - adjustedHalfSpread and round it downward to the next multiple of tickSize. A price already on a tick remains unchanged. Every decimal input is exact and has at most seven digits after the decimal point. Return the tick-rounded quote rounded half upward to six decimal places. Function quoteOneRequest(reference: double, halfSpread: double, penaltyPerUnit: double, quantity: int, side: String, tickSize: double) → double Examples Example 1 reference = 100.0 halfSpread = 0.05 penaltyPerUnit = 0.0002 quantity = 100 side = "BUY" tickSize = 0.01 return = 100.07 The adjusted half spread is 0.05 + 0.0002 * 100 = 0.07. The raw ask 100.07 is already on a 0.01 tick. Example 2 reference = 100.0 halfSpread = 0.05 penaltyPerUnit = 0.0002 quantity = 125 side = "SELL" tickSize = 0.01 return = 99.92 The adjusted half spread is 0.075, so the raw bid is 99.925. Rounding downward to a 0.01 tick gives 99.92. Constraints 0 < reference <= 2 * 10^8 0 <= halfSpread <= 10^6 0 <= penaltyPerUnit <= 10^3 1 <= quantity <= 10^6 side is either BUY or SELL. 10^-6 <= tickSize <= 10^3. Each decimal input has at most seven digits after the decimal point. The raw quote and the rounded quote are positive and at most 2 * 10^8.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is to stop using floating point. Every input has at most seven decimal digits, so multiply everything by 10^7 and work in 64-bit integers, or use BigDecimal or Python's Decimal. Quantity times penalty stays exact this way. Compute the raw price as an integer, then divide by the scaled tick. BUY uses ceiling division, SELL uses floor division, and you multiply back by the tick. A price already on a tick stays unchanged, which ceiling and floor handle naturally. Check overflow: 2*10^8 scaled by 10^7 is 2*10^15, which fits in a long, but penalty times quantity needs care. The common pitfall is using Math.ceil on a double quotient, which misfires on exact ticks. Finally, format to six decimals with half-up rounding. If the scaling logic slips under time pressure, StealthCoder is your hedge on the live OA.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill Quote One Request 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 for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Millennium's OA.
Millennium reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Quote One Request FAQ
What's the trick in Quote One Request?+
Avoid doubles. Scale every decimal by 10^7 into integers, or use a decimal type. Then ceiling-divide by the tick for BUY and floor-divide for SELL. The whole problem is precision and rounding direction, not algorithms.
Why do doubles fail here?+
Values like 99.925 can't be represented exactly in binary floating point. Dividing by a tick of 0.01 may give 9992.499999 or 9992.5000001, so ceil or floor lands on the wrong tick. Exact arithmetic removes that risk completely.
How do I round BUY up and SELL down correctly?+
With scaled integers, BUY is ceil(raw / tick) * tick and SELL is floor(raw / tick) * tick. Use integer ceiling division like (raw + tick - 1) / tick. A price already on a tick divides evenly and stays unchanged.
Is overflow a concern with this problem?+
Yes, a little. Reference up to 2*10^8 scaled by 10^7 is 2*10^15, fine for a 64-bit long. But penalty times quantity times scale factors can grow, so multiply carefully or just use BigDecimal and skip the worry.
How do I prepare for this in 48 hours?+
Write the function once with BigDecimal or scaled longs and test both examples, especially the 99.925 SELL case. Then test a price already on a tick and a tiny tick like 10^-6. That covers nearly every failure mode.