您的位置:首页 > 大数据 > 人工智能

172. Factorial Trailing Zeroes

2016-05-11 21:17 761 查看


172. Factorial Trailing Zeroes

   My Submissions

Question
Editorial Solution

Total Accepted: 58597 Total
Submissions: 178269 Difficulty: Easy

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

Show Tags

Show Similar Problems

Have you met this question in a real interview? 

Yes
 

No

Discuss Notes

class Solution {
public:
int trailingZeroes(int n) {
int ans=0;
while(n)
{
ans+=n/5;
n/=5;
}
return ans;
}
};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: