Skip to main content

Leetcode 172 Factorial Trailing Zeroes

· One min read
class Solution:
def trailingZeroes(self, n: int) -> int:
pw = 5
cnt = 0
while n >= pw:
cnt += n // pw
pw *= 5
return cnt