Quant interview question often contain brain teasers involving mathematics, statistics, and logic. The goal of these questions is to assess your quantitative and reasoning abilities, which can be highly relevant to working as a quant analyst, trader, or developer. Here are 7 quant interview questions of varying difficulties – how many can you solve?
1. Trailing Zeros (easy)
How many trailing zeros does 1000! have?
Solution to #1
249 trailing zeros
A trailing zero is added whenever a number is multiplied by 10. To figure out how many factors of 10 there are, just figure out how many factors of 2 and 5 there are (whichever is fewer).
It’s easy to see that a factorial contains many more factors of 2 than factors of 5, so we just need to figure out how many factors of 5 there are.
1 out of every 5 numbers in the factorial is a factor of 5. However, factors of 25 contains two factors of 5, so they need to be counted twice, and so on for other powers of 5.
So there are:
- 1000 / 5 = 200 factors of 5
- 1000 / 25 = 40 factors of 25
- 1000 / 125 = 8 factors of 125
- 1000 / 625 = 1.6 factors of 625 (which rounds down to just 1 factor, 625 itself)
200 + 40 + 8 + 1 = 249
2. Sum of 4’s and 5’s (medium)
How many numbers from 1 to 1000 (inclusive) can be written as the sum of some number of 4’s and/or 5’s? For example, 4 + 4 + 5 + 5 + 5 = 23.
Solution to #2
994
A good way to solve this:
- Recognize that all multiples of 5 are possible.
- All numbers that are 1 less than a multiple of 5 are possible, by switching out one of the 5’s for a 4.
- For example, 30 = 5 + 5 + 5 + 5 + 5 + 5, so 29 = 4 + 5 + 5 + 5 + 5 + 5.
- By that logic, all numbers between multiples of 5 should be possible, by switching out up to four of the 5’s for 4’s.
- However, this does not work if there are not enough 5’s to switch out for 4’s – which is only true if there were fewer than four 5’s in the sum. So now we know all numbers 15 or greater can be written as the sum of 4’s and 5’s.
- If we just inspect the numbers from 1 to 14, we see that 6 of them cannot be written as the sum of 4’s and 5’s: 1, 2, 3, 6, 7, and 11. Hence 994 of the numbers from 1 to 1000 can be written as the sum of 4’s and 5’s.