All problems
Birthday Threshold Minimum People
Problem
Find the smallest number of people n such that the probability of at least one shared birthday among d days is at least the target.
Given d and the target probability in (0, 1), return n.
Hint
Multiply the distinct-birthday probabilities until the complement reaches the target.
Test cases
case 1
in: [365,0.5]
expected: 23
case 2
in: [365,0.9]
expected: 41
case 3
in: [12,0.5]
expected: 5
Starter codePython
def birthday_threshold_minimum_people(days, target):
# Your code here
pass3 test cases · run your code against them in the editor