javascript solution


  • 0
    E
    var trailingZeroes = function(n) {
        var count = Math.floor(Math.log2(n)/Math.log2(5));
        var zeros = 0;
        for(let i = 1; i <= count; i++){ zeros += Math.floor(n/Math.pow(5,i));}
        return zeros;
    };
    

Log in to reply
 

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