[
math
]
BinarySearch 0365 Trailing Zeros
Problem statement
https://binarysearch.com/problems/Trailing-Zeros/
Solution
What matter, what is the biggest power of 5
we need to have in our number, which can be evaluated with logarithm.
Complexity
It is O(1)
for time and space.
Code
class Solution:
def solve(self, k):
return floor(log(k)/log(5))