FastPrepHigher Roll, or Lose the Sum
Problems/Higher Roll, or Lose the Sum

Higher Roll, or Lose the Sum

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

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A 2026 report on SIG's one-hour online test for quant research and systematic trading interns lists a game played with a pair of ordinary dice. When the two faces show different values the player is paid the larger value, and a tie costs the player both values added together. The task is the average result of one play.

The report has only the six-sided case and asks for the answer to the cent. We chose these. The die has n faces numbered 1 to n. The answer is a decimal accepted within 10^-9 (absolute or relative) instead of a rounded amount. The interview case is the first example. A related SIG problem, Expected Payoff from the Higher of Two Rolls, uses the rule from an older report where a match pays nothing.

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

A fair die has n faces numbered 1 to n. You roll it twice; the two rolls are independent.

  • If the two rolls are different, you win the larger number in dollars.
  • If the two rolls are the same, you lose the sum of the two rolls in dollars.

Return your expected payoff. It may be negative.

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

Function

expectedPayoff(n: int) → double

Examples

Example 1

n = 6return = 2.7222222222222223

This is the interview game. Of the 36 equally likely ordered pairs, 30 differ and pay their larger roll, for a total of 140. The 6 matching pairs lose 2, 4, 6, 8, 10 and 12, a total of 42.

The expected payoff is (140 - 42) / 36 = 49/18, about 2.7222.

Example 2

n = 1return = -2.0

A one-faced die always shows 1 twice, so you always lose 1 + 1 = 2. The answer is -2.

Example 3

n = 2return = -0.5

The pairs (1, 2) and (2, 1) each pay 2. The pair (1, 1) loses 2 and (2, 2) loses 4. The average is (2 + 2 - 2 - 4) / 4 = -0.5.

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
  • Is a Popular Story Fake?OA · Seen Nov 2026
  • Knights, Knaves and Their StatementsOA · 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

Susquehanna International Group (SIG) interview experiences

  • SIG Quant Researcher Experienced Hire Interviews: 11 Experiences
  • SIG Quant Research Intern Interviews: 60 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 expectedPayoff(int n) {
        // Write your code here.
    }
}
Checking account…