def trailingZeroes(self, n):
"""
:type n: int
:rtype: int
"""
re = n
m = 1
for i in range(n):
if re<=0:
break
m*=re
re-=1
last = str(m)
sum = 0
for i in last[-1::-1]:
if i!="0" :
return sum
sum+=1
class Solution:
def trailingZeroes(self, n: int) -> int:
x=1
for i in range(1,n+1):
x*=i
s=0
for j in range(len(str(x)),0,-1):
if str(x)[j-1]=='0':
s+=1
else:
break
return s
assert Solution().trailingZeroes(5)==1
assert Solution().trailingZeroes(3)==0
assert Solution().trailingZeroes(0)==0