Given an integer n, return the number of trailing zeroes in n!. Note that n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1.
Example 1:
Input: {"n":3}
Output: 0
Constraints:
0≤n≤104
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"n":3}
3! = 1 × 2 × ... × 3. Each trailing zero is a factor of 10 = 2 × 5, and factors of 2 are far more common than factors of 5, so the answer is how many 5s divide 3!.
n (now 3 // 5^0)
3
count (factors of 5)
0
Factors of 3!: each dot is one factor of 5 inside that number