Data Structures & AlgorithmsModerateICPC regional · TCS NQT
Problem: Compute 7^2024 modulo 9.
- A. 5
- B. 4
- C. 3
- D. 6
Correct answer: B. 4
Powers of 7 modulo 9 cycle with period 3: 7, 4, 1. Since 2024 is a multiple of 3 plus 2, the residue is the second term of the cycle, which is 4.
More Coding Interview Problems questions
- Problem: What is the multiplicative inverse of 3 modulo 11 (the value x with 0 ≤ x < 11 and 3x ≡ 1 mod 11)?
- Problem: The k = 2 closest points to the origin are chosen from the list (1,3), (−2,2), (5,8), (0,1). Compute the sum of the squared…
- Problem: Intervals [1,4], [3,7] and [6,10] are available. What is the minimum number of these intervals needed to cover the whole segment…
- Problem: Starting from x = 7, apply six times the rule: if x is even, x = x/2 (integer), otherwise x = 2x + 3. What is the final value of x?
- Problem: The words of "the sky is blue" are put in reverse order and joined by single spaces to form a new string. How many characters…
- Problem: The array [1, 2, 3, 4, 5, 6, 7, 8] is rotated left by 3 and then the first 4 elements are reversed. What is the element at index…