2. 尾部的零
解决思路:
n!尾部出现0必定满足其有因子为5或者5^m(m>1,且为整数)
class Solution:
"""
@param: n: An integer
@return: An integer, denote the number of trailing zeros in n!
"""
def trailingZeros(self, n):
# write your code here, try to do it without arithmetic operator
result = 0
temp = n // 5
while temp != 0 :
result += temp
temp //= 5
return result