Data Structures & AlgorithmsModerateICPC regional · TCS NQT
Problem: Compute 2^(2^5) mod 1000 (that is, 2 raised to the power 32, taken modulo 1000).
- A. 296
- B. 24
- C. 96
- D. 648
Correct answer: A. 296
2^32 = 4294967296, so the result is 296 (repeated squaring keeps every step below 1000). Reading 2^(2^5) as (2^2)^5 = 1024 gives 24, working mod 100 gives 96, and an off-by-one exponent 2^31 gives 648.
More Coding Interview Problems questions
- Problem: With coin denominations 1, 7 and 10, what is the minimum number of coins needed to make 97?
- Problem: Job sequencing: five jobs (deadline, profit) are (2, 100), (1, 19), (2, 27), (1, 25), (3, 15). Each job takes one unit of time…
- Problem: Boats carry at most 2 people and a weight limit of 10 per boat. Four people weigh 3, 5, 3 and 4. What is the minimum number of…
- Problem: What is the smallest integer x with x·x ≥ 1,000,000,000?
- Problem: A grid holds oranges: 2 = rotten, 1 = fresh, 0 = empty: [[2,1,1],[1,1,0],[0,1,1]]. Each minute every fresh orange adjacent…
- Problem: Courses 0–5 have prerequisites: 1 needs 0, 2 needs 1, 3 needs 2, 4 needs 5, 5 needs 4. A course can be taken only after all its…