Class Solution
-
- All Implemented Interfaces:
public final class Solution793 - Preimage Size of Factorial Zeroes Function.
Hard
Let
f(x)be the number of zeroes at the end ofx!. Recall thatx! = 1 * 2 * 3 * ... * xand by convention,0! = 1.For example,
f(3) = 0because3! = 6has no zeroes at the end, whilef(11) = 2because11! = 39916800has two zeroes at the end.
Given an integer
k, return the number of non-negative integersxhave the property thatf(x) = k.Example 1:
Input: k = 0
Output: 5
Explanation: 0!, 1!, 2!, 3!, and 4! end with k = 0 zeroes.
Example 2:
Input: k = 5
Output: 0
Explanation: There is no x such that x! ends in k = 5 zeroes.
Example 3:
Input: k = 3
Output: 5
Constraints:
<code>0 <= k <= 10<sup>9</sup></code>
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final IntegerpreimageSizeFZF(Integer k)-
-
Method Detail
-
preimageSizeFZF
final Integer preimageSizeFZF(Integer k)
-
-
-
-