Compute P(A>B) for m- and n-sided dice
Company: Reddit
Role: Data Scientist
Category: Statistics & Math
Difficulty: Medium
Interview Round: Technical Screen
Two fair dice are rolled independently:
- Die **A** has **m** faces labeled \(1,2,\dots,m\).
- Die **B** has **n** faces labeled \(1,2,\dots,n\).
Each face is equally likely.
1) Derive a closed-form expression for \(\mathbb{P}(A > B)\) as a function of \(m\) and \(n\).
2) Optionally, provide a simple Python function to compute it (either via the closed form or via counting).
Quick Answer: This question evaluates understanding of probability theory and discrete combinatorics, specifically reasoning about pairwise outcomes and deriving a parameterized closed-form expression for P(A > B) when A and B are m- and n-sided dice.