Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
class Solution {
public:
int trailingZeroes(int n) {
int power = 1;
int c = 0;
int f = (int) (n/(pow(5, power)));
while(f > 0){
c += f;
f = (int) (n/(pow(5, ++power)));
}
return c;
}
};