Hypergeometric Distribution PMF
Probability Theory DS practice problem on Onlearn.
Difficulty: medium.
Topics: Understanding the Hypergeometric Distribution PMF, Factorial Arithmetic, Floating Point Precision, Boundary Condition Validation, Log-Gamma Transformation, Subset Selection Logic, Probability Theory, Discrete Mathematics, Combinatorics, Statistical Distributions, Numerical Computing, Sampling without Replacement, Binomial Coefficients, Probability Mass Function, Random Variables, Combinatorial Identities.
Implement a function that calculates the Probability Mass Function (PMF) for a Hypergeometric Distribution. Given a population size N, number of successes in the population K, sample size n, and number of observed successes k, return the probability P(X=k). Ensure the function handles edge cases where k is outside the valid range [max(0, n (N K)), min(n, K)].