/172. Factorial Trailing Zeroes

172. Factorial Trailing Zeroes

Medium
Probability46.3% acceptance

Given a non-negative integer input_value, compute and return the count of trailing zero digits in the decimal representation of the factorial of input_value (input_value!).

Example 1

Input: 7

Output: 1

Explanation: 7! = 5040, which has 1 trailing zero.

Example 2

Input: 10

Output: 2

Explanation: 10! = 3628800, which has 2 trailing zeroes.

Example 3

Input: 1

Output: 0

Explanation: 1! = 1, which has 0 trailing zeroes.

Constraints

  • 0 <= input_value <= 10_000
Python (current runtime)

Case 1

Input: 15

Expected: 3

Case 2

Input: 25

Expected: 6

Case 3

Input: 100

Expected: 24

Case 4

Input: 4

Expected: 0

Case 5

Input: 50

Expected: 12