Smallest factorial number
Medium Acceptance 38.79% Points 30.00
Given a number n. The task is to find the smallest number whose factorial contains at least n trailing zeroes.
Examples
Example 1
Example 1
Input: n = 1
Output: 5
Explanation: 5! = 120 which has at least 1 trailing 0.
Example 2
Example 2
Input: n = 6
Output: 25
Explanation: 25! has at least 6 trailing 0.
Hints
Hint 1
Expected Time Complexity: O(log2 N * log5 N).
Hint 2
Expected Auxiliary Space: O(1).
Companies
Apple Visa Walmart
Topics
Searching Algorithms
Track your submissions
Please log in to review your progress and explore code submissions from other participants.
Unlock the full solution
Please log in to access detailed answers and explanations.
Join the discussion
Please log in to join conversations with other participants.