FastPrepTwo Dice Summing to a Target
Problems/Two Dice Summing to a Target

Two Dice Summing to a Target

Susquehanna International Group (SIG) logoSusquehanna International Group (SIG)● EasyINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: In an HR phone screen for a quant internship, the candidate got a basic probability question about the total of two dice.

The report does not say which number or what kind of dice. Here, both dice are fair with faces 1 to faces, where faces is from 1 to 10^5. The target is any whole number from 1 to 2 × 10^5, and a target the dice cannot reach has probability 0. Answers within 10^-9 (absolute or relative) are accepted. The first example uses two ordinary six-sided dice and a target of 7.

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

You roll two fair dice. Each die has faces faces numbered 1 to faces, each face comes up with probability 1/faces, and the two dice are independent.

Return the probability that the two numbers add up to exactly target. If no pair of faces adds up to target, the probability is 0.

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

Function

twoDiceTargetSumProbability(faces: int, target: int) → double

Examples

Example 1

faces = 6target = 7return = 0.16666666666666666

Two ordinary six-sided dice have 36 equally likely results. Six of them add up to 7: 1+6, 2+5, 3+4, 4+3, 5+2 and 6+1. The answer is 6/36 = 1/6.

Example 2

faces = 6target = 10return = 0.08333333333333333

Three of the 36 results add up to 10: 4+6, 5+5 and 6+4. The answer is 3/36 = 1/12, about 0.0833.

Example 3

faces = 4target = 9return = 0.0

Two four-sided dice add up to at most 4 + 4 = 8, so a sum of 9 is impossible and the answer is 0.

Constraints

  • 1 <= faces <= 10^5
  • 1 <= target <= 2 * 10^5

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
  • 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
  • Random Points Inside One ArcPHONE SCREEN · Seen Jan 2025

Similar questions at other companies

  • Automation Pipeline, Part 1: Single WorkerPlaid · PHONE SCREENPlaid interview questions
  • Subtract Two Large Number StringsStackAdapt · PHONE SCREENStackAdapt interview questions
  • Circular Primes Below a LimitAmazon · PHONE SCREEN
  • Palindrome NumberKotak Mahindra Bank · PHONE SCREENKotak Mahindra Bank interview questions
  • Streaming AverageXantium · PHONE SCREEN
  • Fair Coin from a Biased CoinAnthropic · PHONE SCREENAnthropic interview questions
  • Stack Formula InterpreterTypeSafe AI · PHONE SCREEN
  • Employee Count Median, Mean and ModeClay · PHONE SCREEN
  • Newton Square Root to a Guaranteed ToleranceSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Biased Coin: Probability of Exactly h HeadsAkuna Capital · PHONE SCREENAkuna Capital interview questions

Interview reports that mention this question

  • SIG Quant Research Intern Interviews: 60 Experiences

Susquehanna International Group (SIG) interview experiences

  • SIG Quant Researcher Experienced Hire Interviews: 11 Experiences
  • SIG Quant Researcher New Grad Interviews: 49 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 twoDiceTargetSumProbability(int faces, int target) {
        // Write your code here.
    }
}
Checking account…