172. Factorial Trailing Zeroes
Description
Given an integer n, return the number of trailing zeroes in n!.
Could you write a solution that works in logarithmic time complexity?
Constraints
1 <= n <= 104
Approach
Links
Examples
Input: n = 3
Output: 0
Explanation: 3! = 6, no trailing zero.
Input: n = 5
Output: 1
Explanation: 5! = 120, one trailing zero.
Input: n = 0
Output: 0
Solutions
Follow up
Last updated
Was this helpful?