ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
Given an integer n, return the number of trailing zeroes in n!. 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; } } ~~~