Data Structures & AlgorithmsHardGATE CS · ICPC regional
How many integers x in [1, 300] satisfy x ≡ 1 (mod 4) and x ≡ 2 (mod 3)?
- A. 26
- B. 27
- C. 29
- 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.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- What is Euler's totient phi(360), the number of integers in [1, 360] coprime to 360?
- How many unordered pairs of distinct integers {a, b} from 1 to 12 are coprime to each other?
- What is the sum of i^3 mod 7 over i = 1 to 20?
- How many 1 bits does the binary representation of 45 contain?
- A robot on a circle of 8 positions (0 to 7) starts at 0 and jumps 3 positions forward each step, wrapping around. After how many steps…
- Trains arrive at times [900, 940, 950, 1100] and depart at times [910, 1200, 1120, 1130]. What is the minimum number of platforms needed…