Data Structures & AlgorithmsModerateICPC regional · GATE CS

Problem: Compute C(20, 10) modulo 1,000,000,007 (the binomial coefficient).

  1. A. 167960
  2. B. 184756
  3. C. 92378
  4. D. 1048576

Correct answer: B. 184756

C(20, 10) = 184756, which is already below the modulus, so it is unchanged (compute it with Pascal's rule or factorials and modular inverses). C(20, 9) = 167960 is an off-by-one in k, C(19, 9) = 92378 is an off-by-one in n, and 2²⁰ = 1048576 sums the whole row.

More Coding Interview Problems questions

Exams that ask this topic