Skip to content

Instantly share code, notes, and snippets.

@s4553711
Created June 22, 2018 14:36
Show Gist options
  • Save s4553711/32ede0bbec620ca36ce1942aa90f7817 to your computer and use it in GitHub Desktop.
Save s4553711/32ede0bbec620ca36ce1942aa90f7817 to your computer and use it in GitHub Desktop.
class Solution {
public:
int trailingZeroes(int n) {
if (n < 5) return 0;
int count = 0;
while(n >= 5) {
count += floor(n/5);
n /= 5;
}
return count;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment