Clean Accepted Java Solution


  • 0
    C
    public int trailingZeroes(int n) {
        int temp=5;
        int result=0;
        while(n>=temp)
        {
            result+=n/temp;
            temp*=5;
        }
        return result;
    }

  • 0
    E

    You can eliminate one variable and make code even simpler! :) Check java or python solution with log_5(n).


  • 0
    K

    It can't work now.

    Time Limit Exceeded
    Last executed input: 2147483647


Log in to reply
 

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