172. Factorial Trailing Zeroes

 

只要算总共有多少5就可以

 

1 class Solution {
2     public int trailingZeroes(int n) {
3         if(n == 0) return 0;
4         return (n/5) + trailingZeroes(n/5);
5         
6     }
7 }

 

posted @ 2018-10-08 11:41  jasoncool1  阅读(60)  评论(0编辑  收藏  举报