Data Structures & AlgorithmsHardTCS NQT · ICPC regional

Problem: What is the largest integer n such that n! has at most 3 trailing zeros in base 10?

  1. A. 19
  2. B. 15
  3. C. 14
  4. D. 24

Correct answer: A. 19

Zeros of n! jump to 4 at n = 20 (20 contributes a fifth 5), so 19 is the largest n with at most 3. 15 is the first n with 3 zeros, 14 the largest with at most 2, and 24 the largest with at most 4.

More Coding Interview Problems questions

Exams that ask this topic