FastPrepDice Match Game
Problems/Dice Match Game

Dice Match Game

Susquehanna International Group (SIG) logoSusquehanna International Group (SIG)● MediumNEW GRADINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Two reports from SIG quant phone interviews describe the same dice game: reports posted in December 2016 (internship) and October 2018 (new grad, three phone rounds). The candidate and the interviewer each roll two dice. If some number on the candidate's dice also appears on the interviewer's dice, the interviewer wins $1. Otherwise the candidate wins $1. The question is whether to play. The 2018 author worked out that the candidate wins less than half the time.

The reports give no input format or required precision, and do not say the dice are fair. We chose these. Every die is fair. The interview case uses six-sided dice. The number of faces (2 to 100) and how many dice each side rolls (1 to 100 each) are inputs. The stakes stay $1 each way. The function returns your expected gain from one game. The two-dice-each game is the first example, and the reading where the interviewer rolls a single die is the second. Answers within 10^-9 (absolute or relative) are accepted.

Our version is about 85% the same as the reported questions.

You roll myDice fair dice, and the interviewer rolls theirDice fair dice. Every die has sides faces numbered 1 to sides, and all the dice are independent.

  • If at least one number shows up on both sides (on one of your dice and on one of theirs), you pay the interviewer $1.
  • Otherwise, when no number is shared, the interviewer pays you $1.

Return your expected gain from one game, in dollars. A positive value means the game is worth playing.

Your answer is accepted if its absolute error or its relative error is at most 10^-9.

Function

matchGameExpectedGain(sides: int, myDice: int, theirDice: int) → double

Examples

Example 1

sides = 6myDice = 2theirDice = 2return = -0.027777777777777776

This is the interview game: two normal dice each.

The interviewer's two dice show the same number with chance 1/6. Then both of yours miss that number with chance (5/6)^2 = 25/36. With chance 5/6 their dice show two different numbers, and both of yours miss both with chance (4/6)^2 = 16/36.

So no number is shared with chance 1/6 × 25/36 + 5/6 × 16/36 = 105/216, a little under one half. Your expected gain is 105/216 - 111/216 = -6/216 = -1/36, about -0.0278. Do not play.

Example 2

sides = 6myDice = 2theirDice = 1return = 0.3888888888888889

If the interviewer rolls just one die, both of yours miss its number with chance 25/36. The expected gain is 25/36 - 11/36 = 14/36 = 7/18, about 0.3889, so this version is worth playing.

Example 3

sides = 2myDice = 1theirDice = 1return = 0.0

A two-faced die, one each. The numbers match with chance 1/2, so you win and lose $1 equally often and the expected gain is 0.

Constraints

  • 2 <= sides <= 100
  • 1 <= myDice, theirDice <= 100

More Susquehanna International Group (SIG) Phone Screen questions

  • Dice Sum That Is a Multiple of mPHONE SCREEN · Seen Nov 2026
  • Find Median from Data StreamPHONE SCREEN · Seen Nov 2026
  • Painting Arcs to Nearest Neighbors on a CirclePHONE SCREEN · Seen Sep 2026
  • Filter Movies by Inclusive Year RangePHONE SCREEN · Seen Jul 2026
  • Best Single Reroll for Five DicePHONE SCREEN · Seen Feb 2026
  • Catching the Bus to the MoviePHONE SCREEN · Seen Jan 2026
  • Two Dice Summing to a TargetPHONE SCREEN · Seen Jan 2026
  • Median of Uniform Draws in an IntervalPHONE SCREEN · Seen Oct 2025
  • One Number Is the Average of the Other TwoPHONE SCREEN · Seen Jun 2025
  • Which Coin Pattern Shows Up FirstPHONE SCREEN · Seen May 2025

Similar questions at other companies

  • Count Array DerangementsInMobi · PHONE SCREENInMobi interview questions
  • Biased Coin: Probability of Exactly h HeadsAkuna Capital · PHONE SCREENAkuna Capital interview questions
  • Probability of Consecutive HeadsSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Election District Budget Allocation AnalysisIMC Trading · PHONE SCREENIMC Trading interview questions
  • Count Clean Attendance LogsRippling · PHONE SCREENRippling interview questions
  • Count Staircases with Strictly Increasing StepseBay · ONSITE INTERVIEWeBay interview questions
  • Count Shipment SchedulesMorgan Stanley · OAMorgan Stanley interview questions
  • Find Encrypted NumberAmazon · OA
  • Valid PasswordsMathWorks · OAMathWorks interview questions
  • Coloring HousesSnowflake · OASnowflake interview questions

Interview reports that mention this question

  • SIG Quant Research Intern Interviews: 60 Experiences
  • SIG Quant Researcher New Grad Interviews: 49 Experiences

Susquehanna International Group (SIG) interview experiences

  • SIG Quant Researcher Experienced Hire Interviews: 11 Experiences
  • SIG Quant Researcher Intern Interviews: 1 Experience
  • SIG Quant Second-Round Tech Screen: 1 Experience
All Susquehanna International Group (SIG) interview questionsSee Susquehanna International Group (SIG) hiring insights
Saved
class Solution {
    public double matchGameExpectedGain(int sides, int myDice, int theirDice) {
        // Write your code here.
    }
}
Checking account…