Reported September 2026
Millenniumsimulation

Debug the Risk-Limit Quoter

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

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

Millennium reported this one in September 2026, and it looks like a coding question but it's really a careful spec-reading exercise. Two bugs, one function, no algorithm to invent. You fix a hard-cap comparison, flip a skew sign, and get the decimal rounding right. That's the whole thing. If you're taking the OA soon, the risk isn't difficulty, it's sloppiness under a timer. StealthCoder sits invisibly on your screen as a safety net if you blank on the precision part, but you can handle this by reading the rules in order.

The problem

A shipped risk-limit quoter contains two defects: its inventory skew can push a position farther from zero, and it can accept a trade exactly at the hard risk cap. Repair the supplied implementation without changing its interface.
The source-backed Java translation of the shipped starter is reproduced below for diagnosis. It intentionally retains the buggy behavior:
public String[] priceQuote(int currentInventory, String side, int quantity, double reference, double halfSpread, int baseLimit, double softFraction, double skewCoefficient) {
int signedQuantity = side.equals("BUY") ? quantity : -quantity;
long projected = (long) currentInventory + signedQuantity;
double hard = baseLimit;
double soft = softFraction * hard;
if (Math.abs(projected) > hard) {
return new String[]{"reject", "null"};
}
double skew = skewCoefficient * currentInventory;
double quote = side.equals("BUY")
? reference + halfSpread + skew
: reference - halfSpread + skew;
String action = "accept";
if (Math.abs(projected) > soft) {
action = "widen";
quote += side.equals("BUY") ? halfSpread : -halfSpread;
}
double rounded = Math.floor(quote * 1000000.0 + 0.5) / 1000000.0;
return new String[]{action, String.format(java.util.Locale.US, "%.6f", rounded)};
}
For this quoter, apply these corrected rules in order:
Use signedQuantity = +quantity for BUY and -quantity for SELL, then compute projected = currentInventory + signedQuantity.
Set hard = baseLimit and soft = softFraction * hard. If abs(projected) >= hard, return ["reject", "null"].
Otherwise use skew = -skewCoefficient * currentInventory. The base BUY quote is reference + halfSpread + skew; the base SELL quote is reference - halfSpread + skew.
If abs(projected) > soft, return action widen after adding another halfSpread for BUY or subtracting another halfSpread for SELL. Otherwise return action accept.
The two source-backed risk defects to diagnose are the hard-cap comparison and skew sign shown above. For the execution contract, every decimal input is exact and has at most seven digits after the decimal point; do not copy the shipped binary rounding expression into the repaired implementation. Return a two-element string array [action, quote]. A non-rejected quote is rounded half upward to six decimal places and serialized with exactly six digits after the decimal point.

Function
priceQuote(currentInventory: int, side: String, quantity: int, reference: double, halfSpread: double, baseLimit: int, softFraction: double, skewCoefficient: double) → String[]

Examples
Example 1
currentInventory = 900
side = "BUY"
quantity = 100
reference = 100.0
halfSpread = 0.05
baseLimit = 1000
softFraction = 0.6
skewCoefficient = 0.001
return = ["reject","null"]
The projected inventory is exactly 1000. Equality at the hard cap is rejected.
Example 2
currentInventory = 500
side = "SELL"
quantity = 100
reference = 100.0
halfSpread = 0.05
baseLimit = 1000
softFraction = 0.6
skewCoefficient = 0.001
return = ["accept","99.450000"]
Projected inventory is 400, below the soft limit. Correct skew is -0.5, so the SELL quote is 100 - 0.05 - 0.5 = 99.45.

Constraints
-10^9 <= currentInventory <= 10^9
side is either BUY or SELL.
1 <= quantity <= 10^9
0 < reference <= 2 * 10^8 and 0 <= halfSpread <= 10^6.
1 <= baseLimit <= 10^9 and 0 <= softFraction <= 1.
0 <= skewCoefficient <= 10^3.
Each decimal input has at most seven digits after the decimal point.
Every non-rejected quote is positive and at most 10^12.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The problem reduces to a short chain of conditionals plus exact decimal arithmetic. Fix one: reject when abs(projected) >= hard, not just greater than. Fix two: skew is negative, so skew = -skewCoefficient * currentInventory. Long inventory positions push the quote down, which pulls them back toward zero. Then compute the base quote by side, and if abs(projected) > soft, add or subtract one more halfSpread. The real trap is rounding. The statement says every input has at most seven decimal digits and tells you not to copy the floor(x*1e6+0.5) trick. Use BigDecimal with HALF_UP, or scale to integers, and format with exactly six digits. Also use long for projected, since 10^9 plus 10^9 overflows int. If the decimal formatting trips you during the live OA, StealthCoder is the hedge that gives you a clean BigDecimal version fast.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Debug the Risk-Limit Quoter 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 by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Millennium reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Debug the Risk-Limit Quoter FAQ

How hard is the Millennium Debug the Risk-Limit Quoter problem really?+

Easy on logic, tricky on precision. There's no data structure or algorithm. You apply the corrected rules in order. Most failures come from floating-point rounding and the >= versus > boundary, not from the concept itself.

What's the trick to getting the rounding right?+

Don't use double math with floor(x*1e6+0.5). Parse inputs as BigDecimal from their string form, do the arithmetic exactly, then setScale(6, RoundingMode.HALF_UP) and print with toPlainString. That guarantees exactly six digits and half-up behavior.

Which two bugs do I need to fix?+

First, the hard cap: reject when abs(projected) is greater than or equal to hard, so exactly hitting the cap is rejected. Second, the skew sign: it must be negative, -skewCoefficient * currentInventory, so inventory skew pushes toward zero.

What edge cases should I test before submitting?+

Test projected exactly equal to the hard limit, which must reject. Test projected exactly equal to soft, which must accept, not widen. Test softFraction 0 and 1, large inventories near 10^9 using long, and a SELL with negative inventory where skew flips direction.

How do I prepare for this in 48 hours?+

Write the function once in your language with BigDecimal and run both examples. Then check the boundary cases. Practice reading a spec line by line and mapping each sentence to one line of code. That's the entire skill this question tests.

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

OA at Millennium?
Invisible during screen share
Get it