Data Structures & AlgorithmsHardICPC regional · TCS NQT Digital

Problem: In base 8, how many trailing zeros does 100! have?

  1. A. 24
  2. B. 97
  3. C. 32
  4. D. 48

Correct answer: C. 32

v₂(100!) = 50 + 25 + 12 + 6 + 3 + 1 = 97, and each base-8 zero needs three 2s, so ⌊97/3⌋ = 32. 24 is the decimal zero count, 97 the raw power of 2, and ⌊97/2⌋ = 48 is the base-4 count.

More Coding Interview Problems questions

Exams that ask this topic