All problems
Binomial CDF Prefix
Problem
The binomial CDF at k is sum_{j=0}^{k} C(n, j) p^j (1 - p)^(n - j).
Given n, k, and p, return the probability of at most k successes.
Hint
Cumulate the pmf from zero to k.
Test cases
case 1
in: [5,2,0.5]
expected: 0.5
case 2
in: [4,4,0.3]
expected: 0.9999999999999999
case 3
in: [3,0,0.2]
expected: 0.5120000000000001
Starter codePython
def binomial_cdf_prefix(n, k, p):
# Your code here
pass3 test cases · run your code against them in the editor