标签:+= rail count class ret leetcode etc while solution
一:解题思路
Time:O(log_5(n)),Space:O(1)
二:完整代码示例 (C++版和Java版)
C++:
class Solution { public: int trailingZeroes(int n) { int count = 0; while (n > 0) { n /= 5; count += n; } return count; } };
Java:
class Solution { public int trailingZeroes(int n) { int count=0; while(n>0) { n/=5; count+=n; } return count; } }
标签:+= rail count class ret leetcode etc while solution
原文地址:https://www.cnblogs.com/repinkply/p/12627097.html