172. Factorial Trailing Zeroes
2016-05-11 21:17
761 查看
172. Factorial Trailing Zeroes
My SubmissionsQuestion
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;
}
};
相关文章推荐
- flask-mai发送邮件503,553错误
- LeetCode Container With Most Water (Two Pointers)
- selenium---邮件模板
- reflow(回流)和repaint(重绘)及其优化
- POJ 3216 Repairing Company 最少路径覆盖+floyd最短路
- codeforces 651B Beautiful Paintings
- saltstack之(五)数据系统Grains和Pillar
- The dependency `BaiduMapKit` is not used in any concrete target
- EyeKey诚邀您莅临CCTC大会B11展位体验不一样的人脸识别!
- PipeMapRed.waitOutputThreads(): subprocess failed with code N
- Rails ActiveRecord的default_scope的坑
- paint进阶
- The table '#sql-fb5_190a57' is full Operation failed
- git Disconnected:No supported authentication methods available问题解决
- ibatis中的动态SQL:isNotNull,isPropertyAvailable,isNotEmpty,isGreaterThan等标签用法
- Canvas+Paint绘制路径,文字与图形
- CDISC SDTM AE domain学习笔记 - 1
- Tsinsen A1320 Painting 【最大权匹配】【树形DP】
- 发现大量的TIME_WAIT解决办法
- 汇编学习第四课之main函数反汇编