Factorial Trailing Zeroes

Problem Id: 172 Difficulty: Easy


Intuition

Solution


class Solution:
    def trailingZeroes(self, n):
        """
        :type n: int
        :rtype: int
        """
        result = 0
        while n:
            result += n // 5
            n = n // 5
        return result