Leetcode 172. Factorial Trailing Zeroes
Return the number of trailing zeros in n! by determining how many times 10 divides n!, which reduces to counting factors of 5 in the product; compute the sum floor(n/5) + floor(n/25) + ... for an O(log n) solution.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.