Question DSA-MATH-0063
HardWhat is the output of this code?
def nCr_mod(n, r, p):
num = den = 1
for i in range(r):
num = num * (n - i) % p
den = den * (i + 1) % p
return num * pow(den, p - 2, p) % p
print(nCr_mod(10, 3, 13), nCr_mod(100, 50, 1_000_000_007) == __import__("math").comb(100, 50) % 1_000_000_007)
- A.
9 True
- B.
3 True
- C.
Sign up free to see the answer and a step-by-step explanation.