Data Structures & AlgorithmsVery hardICPC regional · Codeforces Div2 D

Problem: The Pascal triangle rows are numbered from row 0 (single 1). What is the sum of all entries in row 12 that are odd?

  1. A. 4096
  2. B. 3104
  3. C. 4
  4. D. 992

Correct answer: D. 992

By Lucas' theorem C(12, k) is odd only for k ⊆ 1100₂, i.e. k = 0, 4, 8, 12: 1 + 495 + 495 + 1 = 992. The whole row sums to 2¹² = 4096, the even entries sum to 3104, and 4 is the count of odd entries, not their sum.

More Coding Interview Problems questions

Exams that ask this topic