Which perfect square of a 4-digit number has the same last four digits as the original number?

Continue reading “Four Digits Squared”# Interview Brain Teasers

Brain teasers you might encounter in a finance, consulting, or engineering interview

## Arrange the Digits

There are 362,880 different ways to arrange the digits 1 through 9 into a 9-digit number. How many of these combinations are prime numbers?

Continue reading “Arrange the Digits”## Deducing Bicycle Spokes

A bicycle shop has some number of unusual bicycles. All their bikes are identical (there’s more than one bike), and each bike’s front and back wheels has at least one spoke each (each bike has more than one spoke). You don’t know how many bicycles are in the shop, but you know there are between 200 and 300 spokes in total.

If you knew the exact number of spokes, you would be able to figure out the number of bicycles.

You don’t know the exact number of spokes, but just knowing the fact that you would be able to figure it out with that information allows you to deduce the answer. How many bicycles and spokes are there?

Continue reading “Deducing Bicycle Spokes”## Guess the Playing Cards

There are three playing cards in a row.

There is a heart to the left of a diamond. There is a five to the right of a jack. There is a club to the left of a diamond. There is a queen to the left of a club.

What are the three cards?

Continue reading “Guess the Playing Cards”## 5 Pirates Puzzle

Five pirates are figuring out how to divide up a newly plundered treasure of 100 gold coins. From most senior to least senior: Pirate A, Pirate B, Pirate C, Pirate D, and Pirate E. The rules:

- The most senior pirate must propose a distribution (for example, giving himself all 100 gold coins and 0 for everyone else), and then all the pirates must vote on it.
- If at least half of the pirates vote for a proposal, the proposal is accepted and the gold is split according to that distribution.
- Otherwise, if the proposal is rejected, the pirate that proposed it is kicked out, and this process repeats with the remaining pirates.
- Each pirate’s main goal is to maximize the gold they receive (but a pirate that is kicked out gets no gold), but are also spiteful enough to prefer kicking out the other pirates, all else equal. The pirates are also distrustful of each other and will not make any side deals, so the distribution of an accepted proposal is final.

What is the greatest number of coins that Pirate A can distribute to himself?

This is a classic logic puzzle, occasionally encountered in tech interviews many years ago.

Preparing for a brain teaser interview? Check out our ultimate guide to brain teaser interviews.

Continue reading “5 Pirates Puzzle”## Wrong Seat Probability

There is a fully-booked flight with 100 seats. The first person decides to ignore the seat assignments, and sits in a random seat. Each subsequent person sits in their assigned seats if available, or sits in a random unoccupied seat if not.

What is the probability that the last person happens to find their assigned seat unoccupied?

Continue reading “Wrong Seat Probability”## Chance of Rain

You are driving to Seattle to meet some friends, and want to know whether you should bring an umbrella. You call up 3 of your friends who live there and independently ask them if it’s raining. Your friends like to mess with you, so each of them has a 1/3 chance of lying. If all 3 friends tell you it is raining, what is the probability it is actually raining there?

This question was asked in an actual Facebook data scientist/data analytics interview.

Preparing for a brain teaser interview? Check out our ultimate guide to brain teaser interviews.

Continue reading “Chance of Rain”## Game the Coin Flip Game

A small company is losing money and the boss is looking for ways to cut costs. The boss is a foolish gambler, so he offers two employees the choice of either taking flat 10% pay cut, or playing the following coin flip game for each paycheck:

- The employees each flip a fair coin – 50% heads and 50% tails; the boss will ensure they are not pulling any tricks.
- They can see their own outcome but not the outcome of the other employee’s coin flip. They must then guess the outcome of the other employee’s coin flip.
- If at least one of them guesses correctly, they get their full paycheck.
- If both of them guess incorrectly, they get nothing.

The two employees take some time to work out a strategy, and then confidently accept the offer to play the coin flip game.

What strategy did they come up with that made them confident the coin flip game will give them more money?

Continue reading “Game the Coin Flip Game”## Secret Translation

The CIA intercepted some messages from a criminal organization, some in English and some in an unknown foreign language or code. As a CIA analyst and translator, you have figured out the following sentences and their English translations, but you do not yet know which sentence matches which translation:

- Casara ashter osar
- Intara amar
- Intara orter osar
- Alatara inter osar
- Ortara amar
- Alatara orter osar

- I see a spy
- I run
- You see me
- You see a spy
- A suspicious man sees an enemy
- You run

You have the opportunity to send a message in order to provoke a reaction from the criminal organization. Can you figure out and match up the translations above, and then send a message saying “a suspicious man runs” in this foreign language?

Continue reading “Secret Translation”## Bribing a Series of Guards

A criminal is planning an escape across a well-guarded bridge, which has a series of 9 guards, who each require a bribe of one coin in order to pass by them in *either *direction.

The criminal can keep a stash of coins in the area before the guards and between each guard. However, he can only carry 4 coins when approaching or passing any guard, in order to remain stealthy and not alert the other guards.

For example, if he starts with 6 coins, he can bring 4 with him to bribe the first guard, and end up with 3 coins in between the first and second guards.

How many coins does the criminal need to bring to the bridge in order to successfully pass by all 9 guards?

Continue reading “Bribing a Series of Guards”