Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
尾0的个数取决于5的个数。
int trailingZeroes(int n) { //C++ if(n <= 0) return 0; int num = 0; int size; while(n!=0){ size = n/5; num += size; n = size; } return num; }
[leetcode]Factorial Trailing Zeroes
原文地址:http://blog.csdn.net/chenlei0630/article/details/42271019