Simple Java Solution


  • 0
    E
    public class Solution {
        public int trailingZeroes(int n) {
            int sum=0;
            while(n!=0){
                sum+=n/5;
                n/=5;
            }
            return sum;
        }
    }
    

Log in to reply
 

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