[
math
]
BinarySearch 0286 Inverse Factorial
Problem statement
https://binarysearch.com/problems/Inverse-Factorial/
Solution
Number of factorials which fit 2**31
limit is not big, we can try them all.
Complexity
It is O(1)
here we can say.
Code
class Solution:
def solve(self, a):
d = {factorial(x):x for x in range(12)}
return d.get(a, -1)