Expected Value of Modified Dice
Updated
Problem statement
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] <= 100and their sum is100.- Every face value is between
-10^6and10^6.
More Jane Street interview questions
- Code Editor FoldingONSITE INTERVIEW · Seen Oct 2026
- Exact-Sixty Dice Game ValueONSITE INTERVIEW · Seen Oct 2026
- Spaceship Equipment LoadoutONSITE INTERVIEW · Seen Oct 2026
- Two-Tower Strategy GameONSITE INTERVIEW · Seen Oct 2026
- Wizard Scroll Allocation StrategyONSITE INTERVIEW · Seen Oct 2026
- Sort TradesPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
- Order Matching EngineONSITE INTERVIEW · Seen Jul 2026
- Order Book Data ValidationONSITE INTERVIEW · Seen Nov 2025
- Biggest Daily Move and Longest Rising StreakOA · ONSITE INTERVIEW · Seen Apr 2021
- Maximum-Scoring Consecutive Tree LevelsPHONE SCREEN · Seen Nov 2026
Similar questions at other companies
- Reservoir Sampling with Recorded DrawsMeta · ONSITE INTERVIEWMeta interview questions
- Group-Relative Policy AdvantagesAmazon · ONSITE INTERVIEW
- Reservoir Sampling with Recorded DrawsStackAdapt · ONSITE INTERVIEWStackAdapt interview questions
- Sliding-Window Averages as Reduced FractionsCoinbase · ONSITE INTERVIEWCoinbase interview questions
- Apply a Sequence of Array RotationsMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Generate Unique Random NumbersGoogle · ONSITE INTERVIEWGoogle interview questions
- K-Means Delivery ZonesDoorDash · PHONE SCREEN · ONSITE INTERVIEWDoorDash interview questions
- Moving Cost by Volume and CategoryWayfair · ONSITE INTERVIEWWayfair interview questions
- Tensor-Parallel MLP GradientsOpenAI · ONSITE INTERVIEWOpenAI interview questions
- Vectorized K-Means AssignmentsSambaNova Systems · ONSITE INTERVIEWSambaNova Systems interview questions
Jane Street interview experiences
- Jane Street TDO UK and Hong Kong: 22 Experiences (Part 10 of 10)
- Jane Street TDOE US Final Round: 11 Experiences (Part 5 of 10)
- Jane Street TDO Phone Math Round: 26 Experiences (Part 9 of 10)
- Jane Street TDOE UK Phone Screen: 15 Experiences (Part 4 of 10)
- Jane Street TDO Excel and VBA Test: 23 Experiences (Part 8 of 10)
- Jane Street TDOE UK Coding Round: 15 Experiences (Part 3 of 10)