Problem editorialhard
Preimage of the factorial zeroes
How many x give x! exactly k trailing zeroes? You never touch a factorial — you count factors of five, notice the count only climbs, and search a number line with no array under it.
19 min read·time O(log² k)·space O(1)
Search the answerMonotone functionLegendre's formula