FastPrepExpected Payoff from the Higher of Two Rolls
Problems/Expected Payoff from the Higher of Two Rolls

Expected Payoff from the Higher of Two Rolls

Susquehanna International Group (SIG) logoSusquehanna International Group (SIG)● EasyFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The assessment asked for the expected payoff of a game: roll a fair six-sided die twice, win the higher roll in dollars when the two rolls differ, and win nothing when they match.

The report only covers the six-sided die. Here, the die has n faces numbered 1 to n, n can be anywhere from 1 to 10^6, and answers within 10^-9 (absolute or relative) are accepted. The interview case is the first example.

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

A game uses a fair die with n faces numbered 1 to n. Each face comes up with probability 1/n. You roll the die twice, and the two rolls are independent.

If the two rolls show different numbers, you win the larger of the two numbers in dollars. If they show the same number, you win nothing.

Return the expected amount you win. Your answer is accepted if its absolute error or its relative error is at most 10^-9.

Function

expectedHigherRollPayoff(n: int) → double

Examples

Example 1

n = 6return = 3.888888888888889

This is the interview case. There are 36 equally likely pairs of rolls. The 6 pairs where both rolls match pay nothing. The higher roll is k in exactly 2(k - 1) of the other pairs. For example, the higher roll is 4 in (1,4), (2,4), (3,4) and the same three pairs in reverse order.

Adding pairs times payoff gives 2 × 2 + 4 × 3 + 6 × 4 + 8 × 5 + 10 × 6 = 140. The answer is 140 / 36 = 35/9, about 3.8889.

Example 2

n = 2return = 1.0

There are 4 equally likely pairs. (1,1) and (2,2) match, so they pay nothing. (1,2) and (2,1) each pay 2. The answer is (2 + 2) / 4 = 1.

Example 3

n = 3return = 1.7777777777777777

There are 9 equally likely pairs, and the 3 matching pairs pay nothing. (1,2) and (2,1) pay 2 each. (1,3), (3,1), (2,3) and (3,2) pay 3 each. The total is 4 + 12 = 16, so the answer is 16/9, about 1.7778.

Constraints

  • 1 <= n <= 10^6

More Susquehanna International Group (SIG) Online Assessment questions

  • Catch Fish with Reusable BaitsOA · Seen Nov 2026
  • Bold Play to Reach a GoalOA · Seen Nov 2026
  • Cats, Truth and Who Has MoreOA · Seen Nov 2026
  • Counting Cows by Their LegsOA · Seen Nov 2026
  • Enough Muffins for the LineOA · Seen Nov 2026
  • Expected Consecutive Pairs Among Chosen NumbersOA · Seen Nov 2026
  • Four-by-Four Boundary GridOA · Seen Nov 2026
  • Frog Paths Without Long RunsOA · Seen Nov 2026
  • Higher Roll, or Lose the SumOA · Seen Nov 2026
  • Is a Popular Story Fake?OA · Seen Nov 2026

Similar questions at other companies

  • Count Valid Square PairsAuxoAI · OA
  • Server InvestmentRippling · OARippling interview questions
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Identification Number Check DigitAbridge · OAAbridge interview questions
  • Count Substrings With Identical CharactersVirtu Financial · OAVirtu Financial interview questions
  • Next Pascal Row CoefficientIntuit · OAIntuit interview questions
  • Digit-Sum Sequence Join PointOpenAI · OAOpenAI interview questions
  • Minimum Testers to Find the Poisoned BottleWalleye Capital · OA
  • Address on Same PageNVIDIA · OANVIDIA interview questions
  • Preorder of a Special Binary TreeNielsen · OA

Interview reports that mention this question

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

Susquehanna International Group (SIG) interview 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 expectedHigherRollPayoff(int n) {
        // Write your code here.
    }
}
Checking account…