Data Structures & AlgorithmsModerateICPC regional · TCS NQT

Problem: Compute 2^(2^5) mod 1000 (that is, 2 raised to the power 32, taken modulo 1000).

  1. A. 296
  2. B. 24
  3. C. 96
  4. 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

Exams that ask this topic