Data Structures & AlgorithmsHardGATE CS
What are the last three digits of 7^2025?
- A. 649
- B. 807
- C. 401
- D. 007
Correct answer: B. 807
7^100 is congruent to 1 modulo 1000 (the order of 7 divides 100), so 7^2025 is congruent to 7^25, which is 807. Using the exponent 2024 or 2026 moves along the cycle by one step.
More Coding Interview Problems questions
- In a jump game, a[i] is the maximum jump length from index i (any length from 1 to a[i] is allowed). For a = [3, 1, 4, 1, 5, 9, 2, 6, 5…
- The sequence a1, ..., a14 is generated by a1 = 1 and a(i+1) = (5a(i) + 3) mod 17. How many pairs (i, j) with i < j satisfy a(i) > a(j)?
- In how many ways can 30 be written as a sum of distinct positive integers, each at most 10, if the order of the summands does not matter?
- An undirected weighted graph on vertices 0-5 has edges (u, v, w): (0,1,2), (0,2,2), (1,3,3), (2,3,3), (1,4,5), (2,4,5), (3,5,1), (4,5,1)…
- Problem: A delivery app logs the parcel weights of a day in an array. Return the indices of the two parcels whose weights add up exactly…
- Problem: Given an unsorted array of n ≤ 10⁵ integers and a target, report whether two different positions hold values summing to the…