思路:本题可转化为求0-n个数里出现了多少个因数5.
1个:5 10 15 20
2个:25 50 75
3个:125 250
所以需要不断的提取因数5
class Solution:
def trailingZeroes(self, n: int) -> int:
res = 0
while n >=5:
res += n//5
n = n//5
return res