Factorial Trailing Zeroes
Start Timer
0:00:00
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 = 5
Output:
def trailingZeroes(n) -> 1
Explanation:
5! = 120, one trailing zero.
Example 2
Input:
n = 10
Output:
def trailingZeroes(n) -> 2
Explanation:
10! = 3,628,800 -> two trailing zero.
Constraints:
0 <= n <= 10^4
.
.
.
.
.
.
.
.
.
Comments