Factorial Trailing Zeroes

Published by Evgeny SH in

Given an integer n, return the number of trailing zeroes in n!.

Examples

trailing_zeroes(6) ➞ 1
# factorial(6) = 720

trailing_zeroes(30) ➞ 7
# factorial(30) = 265252859812191058636308480000000

Notes

Create a solution that works in logarithmic time complexity.

Watch a quick demo on how Edabit works.