Probability and Statistics Problems for Coding Interviews
21 Probability and Statistics problems from real coding interviews, each with test cases you can run online. By difficulty they split into 2 basic, 15 intermediate and 4 advanced.
Solve a few problems of each level, name the pattern after each one and revisit the ones that needed a hint a week later. Practise stating the time and space complexity and the edge cases before you code.
Coding problems
- Expected Rolls to See Every Face (Basic)
- Expected Duration of Gamblers Ruin (Intermediate)
- Gamblers Ruin Probability Modulo (Advanced)
- Expected Maximum of Dice Rolls (Intermediate)
- Birthday Collision Probability Modulo (Intermediate)
- Expected Inversions in Random Permutation (Basic)
- Expected Cycles in Random Permutation (Intermediate)
- Probability of No Adjacent Ones in Random Bits (Intermediate)
- Expected Distinct Values in Random Draws (Intermediate)
- Expected Flips Until Consecutive Heads (Intermediate)
- Expected Coin Flips Until Pattern (Advanced)
- Probability of Dice Sum Modulo (Intermediate)
- Probability of Drawing All Red Balls (Intermediate)
- Expected Empty Bins in Balls and Bins (Intermediate)
- Expected Inversions of Independent Uniform Variables (Advanced)
- First to Roll Target Face Win Probability (Intermediate)
- Probability of Hitting Exact Sum With Dice (Intermediate)
- Expected Rolls to Reach Sum (Advanced)
- Probability of Even Heads Count (Intermediate)
- Expected Isolated Nodes in Random Graph (Intermediate)
- Score Spread Statistic (Intermediate)
Related
Frequently asked questions
How do I get good at probability and statistics problems?
Practise by level, name the pattern after you solve each problem and review the ones you needed hints for. The list is ordered so you can start with the basic ones.
Can I run probability and statistics problems online here?
Yes. Each problem opens in an editor that runs your code against test cases in Java, Python, C++, Go, JavaScript and more.