Data Structures & AlgorithmsVery hardICPC regional · Codeforces Div2 B
Problem: Compute (7^2026 + 11^2026) mod 1000, where ^ is exponentiation.
- A. 410
- B. 1410
- C. 224
- D. 10
Correct answer: A. 410
pow(7, 2026, 1000) = 649 and pow(11, 2026, 1000) = 761, and (649 + 761) mod 1000 = 410. Forgetting the final reduction gives 1410, computing (7 + 11)^2026 mod 1000 gives 224, and working mod 100 keeps only the last two digits (10).
More Coding Interview Problems questions
- Problem: Maximum number of non-overlapping meetings that can be held in one room, where a meeting is an interval [start, end) and two…
- Problem: How many contiguous subarrays of [3, -1, 4, -2, 5, -6, 2, 1] have sum at most 6 when the sum is computed over all non-empty…
- Problem: Longest substring without repeating characters of "pwwkewabcdbbxq". What is its length?
- Problem: Build a binary search tree by inserting 50, 30, 70, 20, 40, 60, 80, 35, 45, 65 in that order (duplicates are not inserted). Count…
- Problem: Starting from an empty tree of directed edges, a DAG has edges 0→1, 0→2, 1→3, 2→3, 2→4, 3→5, 4→5, 1→4. How many distinct directed…
- Problem: An MST is built with Kruskal's algorithm on vertices 0–4 and edges: 0-1 (4), 0-2 (1), 1-2 (2), 1-3 (5), 2-3 (8), 3-4 (3), 2-4…