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?
- A. 4096
- B. 3104
- C. 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
- Problem: Count the strings of length 4 over the alphabet {a, b, c} that contain no two adjacent equal characters and do not contain the…
- Problem: The number of inversions in a permutation of 1..8 given as [4, 7, 1, 8, 2, 6, 3, 5] is what value?
- Problem: On a tree with 9 nodes labelled 1–9, edges 1-2, 1-3, 2-4, 2-5, 3-6, 6-7, 6-8, 8-9, count the unordered pairs of nodes whose path…
- Problem: A string is a palindrome-partition target: what is the minimum number of cuts needed to split "abbacxcaxyyx" into palindromic…
- Problem: A word-ladder graph: vertices are words of length 3 from {cat, cot, cog, dot, dog, hat, hot} and two words are adjacent when they…
- Problem: Count the subarrays of [2, 1, 3, 2, 1, 4, 2] that have exactly 2 distinct values.