Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- /*
- * @param n: A long integer
- * @return: An integer, denote the number of trailing zeros in n!
- */
- long long trailingZeros(long long n) {
- long long counter=0;
- while (n!=0) {
- n /= 5;
- counter += n;
- }
- return counter;
- }
- };
Add Comment
Please, Sign In to add comment