Tuesday, March 29, 2016

LeetCode Q172: Factorial Trailing Zeros

Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.

Solution:
Zeros is produced by "5 x even number", so count how many 5s in each number.


No comments:

Post a Comment