Data Structures & AlgorithmsHardGATE CS · ICPC regional
What is the value of 7^100 mod 9?
- A. 7
- B. 8
- C. 9
- D. 11
Correct answer: A. 7
7^3 = 343 is 1 modulo 9, so the powers of 7 repeat with period 3; since 100 = 3*33 + 1, the value equals 7^1 mod 9.
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
- How many integers x in [1, 100] satisfy that x^2 + x + 41 is divisible by 43?
- Matrices A1 to A6 have dimension sequence p = [30, 35, 15, 5, 10, 20, 25] (matrix i is p[i−1] × p[i]). What is the minimum number of…
- In how many ways can the string "aabaab" be split into one or more contiguous pieces so that every piece is a palindrome? (Each split is…
- A frog starts at position 0 and wants to reach position 12 on a number line. Each move it jumps forward by 1, 3 or 4 units. In how many…
- Grid values [[9, 9, 4], [6, 6, 8], [2, 1, 1]]. A path moves to one of the four neighbouring cells (up, down, left or right) each step, and…
- A square matrix is [[2, 1, 3], [6, 5, 4], [7, 8, 9]]. A falling path starts in row 0 and goes down one row per step, moving to the cell…