Data Structures & AlgorithmsModerateICPC regional · TCS NQT
Problem: What is C(10, 3) modulo 7?
- A. 2
- B. 0
- C. 1
- D. 3
Correct answer: C. 1
C(10,3) = 10 · 9 · 8 / 6 = 120, and 120 = 7 · 17 + 1, so the remainder is 1. Reducing the numerator factors mod 7 first (3 · 2 · 1 = 6) and then dividing by 6 is a quicker route to the same 1; 0 would need 7 to divide 120, which it does not.
More Coding Interview Problems questions
- Problem: How many prime numbers lie strictly between 100 and 150?
- Problem: The number of decimal digits in 100! is what value?
- Problem: What is gcd(462, 1071)?
- Problem: What is the determinant of the matrix [[2, 1], [1, 3]]?
- Problem: How many permutations of the letters A, B, C, D leave no letter in its original position (for example, A is not in the first…
- Problem: The sum of all integers from 1 to 200 that are divisible by neither 4 nor 7 is what value?