Data Structures & AlgorithmsVery hardICPC regional · Codeforces Div2 B

Problem: Find the last digit (units digit) of 7^(7^7) in decimal.

  1. A. 4
  2. B. 2
  3. C. 3
  4. D. 5

Correct answer: C. 3

The units digit of powers of 7 cycles with period 4 (7, 9, 3, 1), so only the exponent mod 4 matters. Reducing the exponent mod 10 instead gives a wrong cycle.

More Coding Interview Problems questions

Exams that ask this topic