InterviewBit Academy is now Scaler!
InterviewBit Academy is now Scaler Academy!

Trailing Zeros in Factorial


Problem Description

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

Note: Your solution should be in logarithmic time complexity.



**Problem Constraints**

1 <= A <= 10000



**Input Format**

First and only argumment is integer A.



**Output Format**

Return an integer, the answer to the problem.



**Example Input**

Input 1:

 A = 4

Input 2:

 A = 5



**Example Output**

Output 1:

 0

Output 2:

 1



**Example Explanation**

Explanation 1:

 4! = 24

Explanation 2:

 5! = 120



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:

Discussion


Loading...
Click here to start solving coding interview questions