标签:
Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
Credits:
Special thanks to @ts for adding this problem and creating all test cases.
Subscribe to see which companies asked this question
int trailingZeroes(int n) { int result = 0; for (long long i = 5; n / i>0; i *= 5) { result += (n / i); } return result; }
标签:
原文地址:http://www.cnblogs.com/sdlwlxf/p/5140241.html