FastPrepBest of n or Win by L
Problems/Best of n or Win by L

Best of n or Win by L

Susquehanna International Group (SIG) logoSusquehanna International Group (SIG)● MediumINTERNPHONE 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 which match a player who wins 60% of single games should choose: best of three, or a match that goes on until someone is two games ahead. The author picked the second and noted that both losing chances can be computed.

Here, the chance p of winning one game (whole percent, 1 to 99), the length n of the best-of match (odd, up to 999) and the lead L that ends the other match (1 to 100) are inputs. Games are independent and have no draws. The function returns the chance of winning the best-of-n match minus the chance of winning the lead-by-L match. A negative answer means the lead-by-L match is better for you. The interview case is the first example. Answers within 10^-9 (absolute or relative) are accepted.

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

You play a match of games against one opponent. You win each game with probability p percent and lose it otherwise; games are independent and there are no draws. You may pick one of two formats:

  • Best of n: play until one player has won (n + 1)/2 games.
  • Lead by L: play until one player has won L more games than the other.

Return the probability that you win the best-of-n match minus the probability that you win the lead-by-L match.

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

Function

formatAdvantage(p: int, n: int, L: int) → double

Examples

Example 1

p = 60n = 3L = 2return = -0.044307692307692305

This is the interview case. Best of three: you win the first two games (0.36), or split them and win the third (2 × 0.6 × 0.4 × 0.6 = 0.288), so 0.648 in all.

Lead by two: look at the games in pairs. A pair you sweep (0.36) wins, a pair you lose twice (0.16) loses, and a split pair (0.48) puts the score back to even. So you win with chance 0.36 / (0.36 + 0.16) = 9/13 ≈ 0.6923. The answer is 0.648 - 9/13 = -72/1625 ≈ -0.0443: lead by two is better.

Example 2

p = 60n = 1L = 1return = 0.0

Best of one and lead by one are both a single game, so both chances are 0.6 and the answer is 0.

Example 3

p = 40n = 3L = 2return = 0.044307692307692305

Now you are the weaker player. Best of three gives 0.16 + 2 × 0.4 × 0.6 × 0.4 = 0.352 and lead by two gives 0.16 / 0.52 = 4/13 ≈ 0.3077. The answer is +72/1625 ≈ 0.0443. For these two formats, the shorter match gives the weaker player the better chance.

Constraints

  • 1 <= p <= 99
  • 1 <= n <= 999
  • n is odd.
  • 1 <= L <= 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

  • Dice-Walk Winning ProbabilityGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • 3D Grid Diagonal Walk ProbabilityApple · PHONE SCREENApple interview questions
  • Coin Game From The EndsTekion · PHONE SCREENTekion interview questions
  • Starting Value with the Longest Collatz ChainZipRecruiter · PHONE SCREENZipRecruiter interview questions
  • Count Array DerangementsInMobi · PHONE SCREENInMobi interview questions
  • Maximum-Product Subarray with an Empty ChoiceAkuna Capital · PHONE SCREENAkuna Capital interview questions
  • Probability of Consecutive HeadsSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Count Staircase WaysGoldman Sachs · PHONE SCREENGoldman Sachs interview questions
  • New 21 Game ProbabilityUiPath · PHONE SCREEN
  • Count Stepping Numbers In RangeAmazon · PHONE SCREEN

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 formatAdvantage(int p, int n, int L) {
        // Write your code here.
    }
}
Checking account…