Data Structures & AlgorithmsHardGATE CS · ICPC regional

How many trailing zeros does 100! have when written in base 6?

  1. A. 97
  2. B. 16
  3. C. 48
  4. D. 33

Correct answer: C. 48

Each base-6 trailing zero needs one 2 and one 3, so the count is min(v₂, v₃). v₃(100!) = 33 + 11 + 3 + 1 = 48, while v₂ = 97. Taking v₂ gives 97, only ⌊100/3⌋ gives 33, and ⌊100/6⌋ = 16 counts multiples of 6.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic