All problems
Birthday Collision Expected Pairs
Problem
Among n people with d equally likely birthdays, the expected number of colliding pairs is C(n, 2) / d.
Given n and d, return the expected number of shared-birthday pairs.
Hint
Linearity of expectation over all pairs.
Test cases
case 1
in: [23,365]
expected: 0.6931506849315069
case 2
in: [10,12]
expected: 3.75
case 3
in: [100,365]
expected: 13.561643835616438
Starter codePython
def birthday_collision_expected_pairs(n, d):
# Your code here
pass3 test cases · run your code against them in the editor