Data Structures & AlgorithmsModerateCodeforces Div2 B · CRT

Problem: Find the smallest positive x satisfying x ≡ 2 (mod 3), x ≡ 3 (mod 5) and x ≡ 2 (mod 7).

  1. A. 128
  2. B. 58
  3. C. 2
  4. D. 23

Correct answer: D. 23

Checking 23: 23 mod 3 = 2, 23 mod 5 = 3, 23 mod 7 = 2. The solution is unique modulo 105, so 128 = 23 + 105 is valid but not the smallest.

More Coding Interview Problems questions

Exams that ask this topic