Extra Coin Win Probability
Problem statement
Player A flips n + 1 independent fair coins, and player B flips n independent fair coins. Return the probability that A obtains strictly more heads than B.
Function
extraCoinWinProbability(n: int) → doubleExamples
Example 1
n = 1return = 0.5A's two coins beat B's one coin with probability one half.
Example 2
n = 100return = 0.5The symmetry argument is independent of n.
Constraints
0 <= n <= 10^9- Results use absolute tolerance
1e-12