Trailing Zeros in Factorial

Given an integer n, return the number of trailing zeroes in n!.

Note: Your solution should be in logarithmic time complexity.

Example :

n = 5
n! = 120 
Number of trailing zeros = 1
So, return 1
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Trailing Zeros in Factorial on Interview Code Editor
Sign Up
to access hints and editorial solutions for Trailing Zeros in Factorial
Asked In:
  • Microsoft
  • Jabong
  • Zillow
Click here to start solving coding interview questions