Smallest factorial number
Easy Accuracy: 16.58% Submissions: 169 Points: 2

Given a number n. The task is to find the smallest number whose factorial contains at least n trailing zeroes.

Example 1:

n = 1
Output: 5
Explanation : 5! = 120 which has at
least 1 trailing 0.

Example 2:

n = 6
Output: 25
Explanation : 25! has at least
6 trailing 0.

User Task:
Complete the function findNum() which takes an integer N as input parameters, and returns the answer.

Expected Time Complexity: O(log2 N * log5 N).
Expected Auxiliary Space: O(1).

1 <= n <= 104

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Output Window