The title

Given an integer n, return n! Result the number of zeros in the mantissa.

Example 1: Input: 3 Output: 0 Description: 3! = 6. There are no zeros in the mantissa. Example 2: Input: 5 Output: 1 Explanation: 5! = 120, with one zero in the mantissa. Note: The time complexity of your algorithm should be O(log n).Copy the code

Their thinking

Class Solution: def trailingZeroes(self, n: int) -> int: ## # def trailingZeroes(self, n: int) -> int: # res *= i # # print(res, i) # # print(res) # resStr = list(str(res)) # resCount = 0 # while resStr.pop() == "0": ResCount = 0 while n >= 5: n //= 5 res += n return res if __name__ == '__main__': nums = 20 result = Solution().trailingZeroes(nums) print(result)Copy the code