Reported October 2026
Jane Streetmath

Expected Value of Modified Dice

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

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

Jane Street reported this one in October 2026, and it looks scarier than it is. Ten dice, 100 rolls split across them, and you return eleven reduced fractions. There's no real data structure beyond an array of integer pairs or a fraction type, but the whole problem hinges on keeping exact rational values instead of floats. It's expectation math plus a gcd reduction. If you've got an OA invite, the risk isn't the idea, it's formatting edge cases like 0/1 and negative signs. StealthCoder is the safety net if you blank mid-assessment, but the pattern is simple enough to own tonight.

The problem

Ten fair six-faced dice are supplied by their complete integer face lists. Die i is rolled rollCounts[i] times, and the counts sum to exactly 100. The game pays the sum of all rolls and charges a fixed entry fee of 350.
Return eleven reduced fractions in numerator/denominator form. The first ten values are the expected face value of each die in index order. The final value is the expected net payout after subtracting the entry fee. A zero value is returned as 0/1, and denominators are always positive.

Function
modifiedDiceExpectations(dice: int[][], rollCounts: int[]) → String[]

Examples
Example 1
dice = [[1,2,3,4,5,6],[1,2,3,4,5,6],[1,2,3,4,5,6],[1,2,3,4,5,6],[1,2,3,4,5,6],[1,2,3,4,5,6],[1,2,3,4,5,6],[1,2,3,4,5,6],[1,2,3,4,5,6],[1,2,3,4,5,6]]
rollCounts = [10,10,10,10,10,10,10,10,10,10]
return = ["7/2","7/2","7/2","7/2","7/2","7/2","7/2","7/2","7/2","7/2","0/1"]
Every die has expectation 3.5, so one hundred rolls have expected payout 350 and net expectation zero.
Example 2
dice = [[1,1,3,4,5,6],[1,2,2,4,5,6],[1,2,3,3,5,6],[1,2,3,4,4,6],[1,2,3,4,5,5],[2,2,3,4,5,6],[1,3,3,4,5,6],[1,2,4,4,5,6],[1,2,3,5,5,6],[1,2,3,4,6,6]]
rollCounts = [100,0,0,0,0,0,0,0,0,0]
return = ["10/3","10/3","10/3","10/3","10/3","11/3","11/3","11/3","11/3","11/3","-50/3"]
Only the first modified die is rolled, giving expected payout 1000/3 and net expectation -50/3.

Constraints
dice.length == rollCounts.length == 10.
Every die has exactly six integer face values.
0 <= rollCounts[i] <= 100 and their sum is 100.
Every face value is between -10^6 and 10^6.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is linearity of expectation. Each die's expected value is sum(faces)/6, so store it as a numerator (the face sum) over 6 and reduce with gcd. The net payout is sum over i of rollCounts[i] * faceSum[i] / 6, minus 350. Put everything over 6: total = (sum of rollCounts[i]*faceSum[i] - 2100) / 6. Then reduce once. Pitfalls: using doubles, which breaks exact fractions. Forgetting that gcd(0, 6) is 6, so zero reduces to 0/1 naturally if you divide correctly. Negative numerators need the sign kept on top with a positive denominator. Face values reach 10^6 and rolls reach 100, so products are about 6*10^8 in total. Use 64-bit anyway. If you freeze during the live OA, StealthCoder can hand you the reduction helper, but it's about fifteen lines.

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 Expected Value of Modified Dice 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 Jane Street's OA.

Jane Street 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.

Expected Value of Modified Dice FAQ

How hard is the Jane Street Expected Value of Modified Dice problem really?+

Easy on the math, fiddly on the output. Expectation of a fair die is just the face sum divided by 6, and linearity gives the total. Most lost points come from fraction formatting, not from the idea itself.

What's the trick to solving it?+

Linearity of expectation with exact integers. Keep each die as faceSum/6, compute the net as (sum of rollCounts[i]*faceSum[i] - 2100)/6, then reduce by gcd. Never touch floating point.

How do I handle zero and negative results?+

Zero must print as 0/1, and the denominator must always be positive. Compute gcd with absolute values, divide both parts, and if the denominator is negative flip both signs. With denominator 6 it's always positive already, but the check is cheap.

Do I need big integers or special data structures?+

No. Max magnitudes are around 6*10^8 in total, which fits in 64-bit integers. An array of ten face sums and a small gcd function is all you need. Use long in Java to be safe.

How do I prepare for this in 48 hours?+

Write the reduce-fraction helper from memory and test it on 0, negatives, and already-reduced values. Then run both examples by hand. Check that the sample 10/3 and -50/3 results match your output exactly, including the string format.

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

OA at Jane Street?
Invisible during screen share
Get it