My python solution


  • 0
    C
    class Solution(object):
        def trailingZeroes(self, n):
            """
            :type n: int
            :rtype: int
            """
            r, five = 0, 5
            c = n/five
            while c>0:
                r += c
                five *= 5
                c = n/five
            return r

Log in to reply
 

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