Data Structures & AlgorithmsHardGATE CS · ICPC regional
How many integers x in [1, 100] satisfy x ≡ 3 (mod 4) and x ≡ 7 (mod 10)?
- A. 6
- B. 7
- C. 9
- D. 5
Correct answer: D. 5
The two conditions combine to x ≡ 7 (mod 20), giving 7, 27, 47, 67 and 87 in range.
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 2^100 mod 9?
- A 12-hour clock shows 1:30 p.m. Ignoring seconds, what hour (1 to 12) is shown 500 minutes later?
- Starting at x = 1, repeatedly apply x -> 3x mod 11. How many steps are needed to return to 1?
- Starting from n = 100, repeat: if n is divisible by 3, divide it by 3; otherwise subtract 1. How many steps are needed to reach 1?
- Which structure finds the k-th largest element of a data stream after each insertion with O(log k) time per element and O(k) space?
- Which method checks in O(n) whether two strings are isomorphic (a one-to-one character mapping turns one into the other)?