Simplest C++ Solution


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

Log in to reply
 

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