FastPrepSame Face Many Times in a Row
Problems/Same Face Many Times in a Row

Same Face Many Times in a Row

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

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: An internship report posted in March 2019 lists nine questions from a first SIG technical phone screen. One asks for the expected number of rolls to get a 6, and then for the expected number of rolls to get two 6s in a row (the report writes it as 6-6).

The report gives one die and two run lengths. Here, the die is fair with d faces (2 to 100), one face is the target, and the run length k (1 to 100) is an input. The function returns the expected number of rolls until the target face has come up k times in a row. A six-sided die with k = 1 and with k = 2 gives examples 1 and 2. Answers within 10^-9 (absolute or relative) are accepted.

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

You roll a fair die with d faces, numbered 1 to d, again and again. One face, say face d, is the target.

Return the expected number of rolls until the target face has come up k times in a row, counting every roll including the last one.

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

Function

expectedRollsForRun(d: int, k: int) → double

Examples

Example 1

d = 6k = 1return = 6.0

This is the first interview question. Each roll is a 6 with chance 1/6, so the wait for the first 6 is 6 rolls on average.

Example 2

d = 6k = 2return = 42.0

This is the second interview question, two 6s in a row. First get one 6, which takes 6 rolls on average. Then roll once more: with chance 1/6 it is a 6 and you are done; otherwise you start over. So T = (6 + 1) + (5/6) T, which gives T = 6 × 7 = 42.

Example 3

d = 2k = 3return = 14.0

A coin with heads as the target, three heads in a row. Two in a row takes 2 × (2 + 1) = 6 tosses on average, and three takes 2 × (6 + 1) = 14.

Constraints

  • 2 <= d <= 100
  • 1 <= k <= 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

  • 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 expectedRollsForRun(int d, int k) {
        // Write your code here.
    }
}
Checking account…