Data Structures & AlgorithmsHardGATE CS · ICPC regional
What is 2^100 mod 7?
- A. 2
- B. 3
- C. 4
- D. 6
Correct answer: A. 2
Since 2^3 = 8 is 1 modulo 7, the powers repeat every 3 steps, and 100 = 3*33 + 1 leaves a remainder of 1, so 2^100 is 2 modulo 7.
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
- Every element of the circular array [1, 2, 3, 4] is replaced by the sum of its two circular neighbours, taken modulo 10, simultaneously…
- How many pairs a < b with 1 <= a < b <= 12 satisfy gcd(a, b) = b - a?
- How many integers n in [1, 60] satisfy n^2 - n divisible by 6?
- What is the length of the longest contiguous subarray of [4, 3, 2, 6, 1, 5] whose sum is at most 10?
- How many times does the pattern aab occur in the string aabaabaab, counting overlapping matches?
- How many pairs (a, b) with 1 <= a <= b <= 12 satisfy lcm(a, b) > 36?