FunctionRacerProblemsRace

Trailing Zeroes in Factorial

MediumMathPython, JavaScript, TypeScript, Java, C++

Return how many zeros the number n! (n factorial, 1 * 2 * ... * n) ends with. Aim to do it without computing the factorial.

Example 1

n 5
returns 1

5! = 120, one trailing zero.

Example 2

n 10
returns 2

10! = 3628800, two trailing zeros.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems