 # Interview Question: How Many Zeros in 100 Factorial (100!)?

## Strategy and Approach to Answering a Problem Solving Interview Question

If you get asked a problem solving question in an interview, remember that they are NOT looking for the RIGHT answer. They are evaluating the approach you use to think out and solve the problem. A strong candidate demonstrates the following:

1. Evaluates and understand the scope of the problem
2. Communicates assumptions
3. Demonstrates quantitative analytical skills
4. Answers the question that has been asked. You’d be surprised how many candidates get lost in the analysis and solve for a different question than what was asked.

## How to Answer this Problem Solving Interview Question

A factorial is, 100! = 100 * 99 * 98 * … * 2 * 1

We know that each pair of 2 and 5 will give a zero. If we perform prime number decomposition on all the numbers in 100!, it is obvious that the frequency of 2 will far outnumber of the frequency of 5. So the frequency of 5 determines the number of trailing zeros. Among numbers 1,2, … ,99, and
100, 20 numbers are divisible by 5 (5, 10,…, 100 ). Among these 20 numbers, 4 are divisible by 5^2 ( 25, 50, 75, 100 ). So the total frequency of 5 is 24 and there are 24 zeros.

Note: For this problem solving job interview question, there is an actual logical answer, however the interviewer will want to evaluate your thinking process.  In answering the interview question, the lead up to your answer will be just as important as the actual answer itself.

For more problem solving, brain teasers, riddles, puzzles, logic job interview questions, please check our out Problem Solving Interview Section.