Data Structures & AlgorithmsModerateICPC regional · GATE CS
Problem: What is the multiplicative inverse of 3 modulo 11 (the value x with 0 ≤ x < 11 and 3x ≡ 1 mod 11)?
- A. 5
- B. 3
- C. 4
- D. 6
Correct answer: C. 4
Since 3 × 4 = 12 ≡ 1 mod 11, the inverse is 4. The extended Euclidean algorithm finds the same value.
More Coding Interview Problems questions
- 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…
- Problem: The string "abcdefgh" is cut into pieces of length 3 from the left (the last piece may be shorter). The pieces are then sorted…