FastPrepExpected Pairs in a Dealt Hand
Problems/Expected Pairs in a Dealt Hand

Expected Pairs in a Dealt Hand

Susquehanna International Group (SIG) logoSusquehanna International Group (SIG)● EasyFULLTIMENEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The assessment asked for the expected number of pairs in a five-card hand dealt from an eight-card deck with two cards each of four ranks (10, J, Q and K).

The report gives only that deck and hand size. Here, the deck can have 1 to 10^6 ranks with two cards each. The hand can be anything from 1 card to the whole deck. A pair means both cards of one rank are in the hand. 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 deck has ranks different ranks and exactly two cards of each rank, so it holds 2 * ranks cards. The deck is shuffled well, and you are dealt handSize cards without replacement. Every set of handSize cards is equally likely to be your hand.

A pair is a rank whose two cards are both in your hand. Return the expected number of pairs in your hand.

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

Function

expectedPairs(ranks: int, handSize: int) → double

Examples

Example 1

ranks = 4handSize = 5return = 1.4285714285714286

This is the interview case: an 8-card deck with two cards each of 4 ranks, and a 5-card hand. There are C(8, 5) = 56 equally likely hands. Five cards from only four ranks always include at least one pair.

A hand has exactly one pair in 4 × 8 = 32 ways: choose the paired rank, then one of the two cards of each other rank (2^3 = 8 ways). It has two pairs in 6 × 4 = 24 ways: choose the two paired ranks (6 ways), then one of the 4 remaining cards. The answer is (32 × 1 + 24 × 2) / 56 = 80/56 = 10/7, about 1.4286.

Example 2

ranks = 2handSize = 2return = 0.3333333333333333

The deck has 4 cards: two of the first rank and two of the second. There are 6 possible two-card hands, and 2 of them hold both cards of one rank. The answer is 2/6 = 1/3.

Example 3

ranks = 3handSize = 4return = 1.2

The deck has 6 cards, and the hand leaves out 2 of them. There are C(6, 2) = 15 ways to pick the two left-out cards. In 3 of them both left-out cards have the same rank, so the hand holds the other 2 ranks as pairs. In the other 12 they have different ranks, so the hand has only 1 pair. The answer is (3 × 2 + 12 × 1) / 15 = 18/15 = 1.2.

Constraints

  • 1 <= ranks <= 10^6
  • 1 <= handSize <= 2 * ranks

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

  • Next Pascal Row CoefficientIntuit · OAIntuit interview questions
  • Subarray SumVisa · OAVisa interview questions
  • Drawing EdgeWeRide · OAWeRide interview questions
  • Drawing EdgeIBM · OAIBM interview questions
  • Drawing EdgeSnowflake · OASnowflake interview questions
  • Process SchedulingCitadel · OACitadel interview questions
  • Unique Digits in RangeAgoda · OAAgoda interview questions
  • Ordered Book Displays with a Featured BookIMC Trading · OAIMC Trading interview questions
  • Find Max Number of PairsRoblox · OARoblox interview questions
  • Count Nondecreasing Digit-Sum ArraysMicrosoft · OAMicrosoft interview questions

Interview reports that mention this question

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

Susquehanna International Group (SIG) interview experiences

  • SIG Quant Researcher Experienced Hire Interviews: 11 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 expectedPairs(int ranks, int handSize) {
        // Write your code here.
    }
}
Checking account…