Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

How many trailing zeros does 50! have when written in base 12 (note 12 = 2^2 * 3)?

  1. A. 23
  2. B. 24
  3. C. 26
  4. D. 22

Correct answer: D. 22

Each trailing zero needs two factors of 2 and one factor of 3, so the count is the minimum of floor(v2/2) and v3, where v2 = 47 and v3 = 22.

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

Exams that ask this topic