JavaScript Solution


  • 0
    I
    /**
     * @param {number} n
     * @return {number}
     */
    var trailingZeroes = function(n) {
        var cur = 5,
            total = 0;
        
        while (cur <= n) {
            total += Math.floor(n / cur);
            cur *= 5;
        }
        
        return total;
    };
    
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.