c++ 4ms solution with explanation

  • 0

    The way that I used to calculate the number is by first dividing 5, and the result is A1, then divide 5 continuously until the original number is 0, during this process, we generated a series of A1, A2,A3..., simply taking the sum of these numbers is the final result.

    int count = 0;
    count += n/5;
    n /= 5;
    return count;

Log in to reply

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