Participate in Codex, Test Your Skills & Win BIG

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:


Output 2:


**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
  • Hint 1
  • Solution Approach
  • Complete Solution
Asked In:


Click here to start solving coding interview questions