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
Interview Code Editor
  • Solution Approach
  • Complete Solution
11917 successful submissions.
Asked In:
  • Microsoft
  • Jabong
  • Zillow
Click here to jump start your coding interview preparation