python simple solution, 35 ms


  • 0
    A
    def trailingZeroes(self, n):      
            count = 0
            i = 1
            while pow(5, i) <= n:
                count += n//pow(5, i)
                i+=1
            return count
    

Log in to reply
 

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