Data Structures & AlgorithmsHardGATE CS · ICPC regional

How many integers x with 1 <= x <= 100 satisfy x mod 3 = 2 and x mod 5 = 3?

  1. A. 8
  2. B. 7
  3. C. 6
  4. D. 10

Correct answer: B. 7

The two congruences combine by the Chinese remainder theorem into x mod 15 = 8, so the solutions are 8, 23, 38, and so on.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic