172. Factorial Trailing Zeroes

题目分析

Given an integer n, return the number of trailing zeroes in n!.

Note: Your solution should be in logarithmic time complexity.
参考

代码

class Solution {
    public int trailingZeroes(int n) {
        return n / 5 == 0 ? 0 : n / 5 + trailingZeroes(n / 5);
    }
}

你可能感兴趣的:(172. Factorial Trailing Zeroes)