The TransCompilator

Solved LeetCode program · 567 of 1,000

#0793 · Preimage Size of Factorial Zeroes Function

Hard Math chunk-12.md

Original English source

Keep a shared trail of 0.

To tally from value (a whole number). If value is less than 5, return. Set value to value divided by 5. Add value to trail. Tally from value.

The low is 0, while the high is 20. The aim is 3.
Repeat while low is less than high.
The middle is (low plus high) divided by 2. Set trail to 0. Tally from middle. If trail is at least aim, set high to middle, otherwise set low to middle plus 1.

Set trail to 0. Tally from low. If trail is aim, show 5, otherwise show 0.

Open in Playground Browse all 1,000 problems

Expected stdout

5