3ms simple C++ solution


  • 0
    Y
    class Solution {
    public:
        int trailingZeroes(int n) {
            int reval(0);
            while(n){
                reval += n/5;
                n /=5;
            }
            return reval;
        }
    };
    

Log in to reply
 

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