Data Structures & AlgorithmsVery hardICPC regional · Amazon SDE OA

What is the smallest positive integer n such that n! ends in exactly 10 trailing zeros?

  1. A. 46
  2. B. 50
  3. C. 45
  4. D. 40

Correct answer: C. 45

Trailing zeros of n! equal the sum of floor(n/5^k). The first n reaching exactly 10 is 45, since 45 gives 9 + 1 = 10 and 40 gives only 9 zeros.

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

Exams that ask this topic