Data Structures & AlgorithmsHardGATE CS · ICPC regional

How many integers x in [1, 300] satisfy x ≡ 1 (mod 4) and x ≡ 2 (mod 3)?

  1. A. 26
  2. B. 27
  3. C. 29
  4. D. 25

Correct answer: D. 25

The two congruences combine to x ≡ 5 (mod 12), so the solutions are spaced 12 apart: 5, 17, 29, and so on.

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

Exams that ask this topic