All problems
Occupancy Zero Bins Probability
Problem
When n balls are thrown independently into m equally likely bins, the probability a given bin stays empty is (1 - 1/m)^n.
Given m and n, return the probability that a specific bin is empty.
Hint
Each ball avoids the bin with probability 1 - 1/m.
Test cases
case 1
in: [10,5]
expected: 0.5904900000000001
case 2
in: [2,1]
expected: 0.5
case 3
in: [100,200]
expected: 0.13397967485796172
Starter codePython
def occupancy_zero_bins_probability(m, n):
# Your code here
pass3 test cases · run your code against them in the editor