My 44ms Python solution


  • 0
    J
    class Solution(object):
        def trailingZeroes(self, n):
            """
            :type n: int
            :rtype: int
            """
            if n<5:
                return 0
            else:
                sums  = 0
                i = 1
                #only 5, 25 ,125...can increase the 0 numbers.
                while n//(5*i) >=1:
                    sums += n//(5*i) 
                    i*=5 
                return sums

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.