We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I found the tutorial brining in negative binomials a bit confusing. Isn't a clean way to compute this simply that the probability of not producing a defect in n=5 rounds covers the only possibility other than a defect occurring during the first n=5 inspections?
python
n = 5; p = 1 / 3.0; q = 1.0 - p;
print(f"{(1.0-q**n):.3f}")
// or in C
double p = 1.0/3.0;
double q = 1 - p;
printf("%.3f", 1 - pow(q, 5));`
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 4: Geometric Distribution II
You are viewing a single comment's thread. Return to all comments →
I found the tutorial brining in negative binomials a bit confusing. Isn't a clean way to compute this simply that the probability of not producing a defect in n=5 rounds covers the only possibility other than a defect occurring during the first n=5 inspections?