Brain Teasers and Puzzles

Brain teasers, puzzles, riddles, and other challenges

The Impossible Puzzle

This puzzle was coined the “Impossible Puzzle” by Martin Gardner, a famous math and science writer that liked to create and write about math games and puzzles. The puzzle is named as such because it appears to provide insufficient information to solve, but it is in fact solvable! Read on for the puzzle and the (very difficult) solution.


There are two distinct whole numbers greater than 1, we can call them x and y (where y > x). We know the sum of x and y is no more than 100.

Sam and Prada are perfect logicians. Sam (“sum”) is told x + y and Prada (“product”) is told x * y, and both of them know all the information provided so far.

Sam and Prada have this conversation in which they truthfully deduce the numbers:

  1. Sam: I know Prada does not know x and y.
  2. Prada: Well now I know x and y.
  3. Sam: Ah, now I also know x and y.

Can you figure out x and y using this information?

View Solution

Truel

A truel is a three-way duel. The three participants take turns firing one shot at whichever opponent they choose, until only one is remaining.

Allison, Ben, and Chase are in a truel, and have varying degrees of accuracy: Allison has a 50% chance of hitting her intended target, Ben has a 80% chance, and Chase has a 100% chance. Allison gets to shoot first, then Ben, then Chase, and repeating in that order until only one person is remaining.

Assume that the accuracy of all participants are publicly known, and everyone is trying to maximize their chances of winning. What is Allison’s optimal strategy, and what is her likelihood of winning under that strategy?

Continue reading “Truel”

Reroll the Die

Suppose there is a game in which you roll a fair, 6-sided die and win dollars equal to the outcome of the roll. How much would you expect to win on average?

Suppose, if you don’t like the outcome of the roll, you can reroll the die once, and win dollars equal to the outcome of the 2nd roll (once you choose to reroll, you can no longer go back to the 1st roll). How much would you expect to win on average?

Suppose, if you don’t like the outcome of the 2nd roll, you can reroll the die once more, and win dollars equal to the outcome of the 3rd roll (once you choose to reroll, you can no longer go back to previous rolls). How much would you expect to win on average?


This was an actual brain teaser question once asked at Jane Street for an interview for an intern role.

Continue reading “Reroll the Die”

7 Quant Interview Questions and Answers

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.
Continue reading “7 Quant Interview Questions and Answers”