172. Factorial Trailing Zeroes
2016-04-24 14:10
337 查看
Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
Note: Your solution should be in logarithmic time complexity.
public class Solution { public int trailingZeroes(int n) { int res = 0; while(n!=0) { res += n/5; n /= 5; } return res; } }
相关文章推荐
- HDU 2389 Rain on your Parade (HK二分图)
- rt3070无线网卡工作在staion模式----fl2440开发板
- leetcode-217. Contains Duplicate
- 5、Jenkins Email Extension Plugin插件使用说明
- hdu3487Play with Chain【splay】
- 计算机视觉和人工智能领域:教程、网站、博客记录(陆续更新)
- spoj16935 Straight Line Spiral Pattern (Act 3)
- TIME_WAIT状态原理
- “人工智能大脑”跳槽记:吴恩达所理解的智能
- 【AI开发第一步】微软认知服务API应用
- http://blog.csdn.net/huang_xw/article/details/7090173
- USACO|Barn Repair|堆|贪心|动态规划
- 详解wait和waitpid函数
- MapInfo启动时,提示the Microsoft jet engine is not available
- 备份Foxmail7.2邮箱
- JetBrains发布了IntelliJ IDEA 2016.1
- rails 笔记
- 通过RAII机制实现资源的自动释放
- #leetcode#70.Climbing Stairs
- 与人工智能相关的创业公司或团队