Expected Self-Matches in a Random Team Gift Exchange
Last updated: November 29, 2026
Quick Overview
A Google team of n people draws names at random for a gift exchange. What is the expected number of people who draw their own name, and what is its variance?
0
0
0 solved
A Google team of n people draws names at random for a gift exchange. What is the expected number of people who draw their own name, and what is its variance?
A classic Google phone screen warm-up that tests linearity of expectation. The interviewer wants to see indicator variables used instead of a brute-force count of permutations, and often follows with the variance or the probability nobody draws themselves.
What the Interviewer Expects
- Define indicator variables per person
- Apply linearity of expectation to get 1 regardless of n
- Compute the variance using pairwise indicator products
- Note the derangement probability tends to 1/e
- Avoid assuming independence of indicators
Key Topics to Cover
How to Approach This
- Define your hypotheses (H0 and H1) clearly before performing any test.
- Calculate required sample size BEFORE running an experiment, using power analysis.
- Remember the Central Limit Theorem: sample means become approximately normal with large n.
- Watch for Simpson's paradox. Always segment data by key dimensions.
- Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
- What is the probability that nobody draws their own name?
- Why does linearity of expectation work even though the indicators are dependent?
- What is the expected number of 2-cycles (pairs who draw each other)?
- How would you redraw so that no one gets themselves while staying uniform?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Browse Statistics QuestionsSample Answer
Clarify
The assignment is a uniformly random permutation of names, . A self-match (fixed point) is a person who draws their own name. We want and where is the number ...
Approach
Write where if person draws themselves. Linearity of expectation does not need independence. For the variance, expand into diagonal and off-diagonal ter...