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 operators.
return 0 if not n else n // 5 + self.trailingZeros(n // 5)
python实现n阶乘0尾数计算
最新推荐文章于 2024-04-08 18:29:44 发布