15 data science Interview puzzles | Common interview puzzles

Top 15 Data Science Interview puzzle questions with answers

Data science interviews usually revolve around business case studies, core concepts, and analytical puzzle questions. Among these, puzzles are interviewers’ favorite kind of questions to ask the candidate. This is because it tests how the candidate performs complex and tangled problems through logic.

BY Henry

19th August 2020

Top 15 data sciencs interview puzzles with answers - Verzeo

Puzzles are a way to test the analytical, logical and lateral thinking skills of the candidate

To help you achieve these skills, I will share some of the hardest data science puzzles which candidates come across in a data science job interview. These puzzles are specific not only to data science interviews but also to other analyst job interviews.

You might find similar puzzles all over the internet but read through them carefully as they have been tweaked a little bit, specifically to make you think harder. The interviewer can make such small variations to the puzzles to put you under pressure and test your analytical skills.

But, the main point to understand here is that the interviewer is testing your problem-solving skill. He is looking at how you approach a particular set of problems. So, its OK if you do not give him with right answer.

So without wasting any more time, let’s get started!

15 Job Interview Puzzles

Question 1

Four people A, B, C, D need to cross the bridge at night, and they have only one torch. The bridge is too dangerous to cross without a torch and is strong enough to support a maximum of two people at a time. They take 1,2,5 and 8 minutes respectively. What is the shortest time needed for all four to cross the bridge?

Bridge crossing interview question - Verzeo

A and B, are the two fastest persons who can cross the bridge.

First, in 2 minutes they both(A & B) can cross the bridge.

B stays on the other side and A gets the torch and moves back to the other end in 1 minute. This makes the total time of 3 minutes.

Now C and D can cross the bridge who take 5 and 8 minutes respectively. The total time taken by them to cross the bridge is 8 minutes.

At this point, the total time taken is 3+8 minutes which is 11 minutes.

Now C and D stay on the other side and B goes back to the other side in 2 minutes. This makes the total time spent as 11+2 which is 13 minutes.

At last, A and B will cross the bridge in 2 minutes which is 15 minutes.


So the minimum time it takes to cross the bridge by 4 of them is 15 minutes.

Question 2

There are two sand timers which show 4 minutes and 7 minutes respectively. What would be the best approach to get a time of 9 minutes using both the sand timers, at one time or one after another, or in any other combination?

Hour glass problem - Verzeo

Turn both of them upside down simultaneously.

After 4 minutes, the smaller hourglass is finished and the bigger timer has 3 minutes left.

At this point restart the smaller timer by turning upside down and continue the process.

After the completion of 7 minutes, the bigger timer is finished and the smaller one has 1 minute remaining.

Turn the big timer upside down

When the smaller one is finished, the bigger one has run for 1 minute. Turn it upside down and when its completed, we have clocked 9 minutes.

Question 3

You have 10 bags full of coins, in each bag are infinite coins. But one bag is full of forgeries and you can’t remember which one but you know that genuine coins weigh 1 gram and forgeries one weighs 1.1 grams. Identify the bag with the minimum readings, provided with a digital weighing machine.

Bag of coins problem - Verzeo

Take 1 coin from the first bag, 2 coins from the second bag,3 bags from the third bag, and so on. Eventually, we will get 55 (1+2+3….) coins. Now weigh all the 55 coins together on the weighing machine.

If the reading ends with 0.3 then it is the 3rd bag because we took 3 coins from it which add the extra 0.3 to the total weight. Similarly, If it ends with 0.5 then it is the 5th bag and so on.

Question 4

There are 100 prisoners all sentenced to death. One night before the execution, the warden gives them a chance to live if they all work on a strategy together. The scenario is as follows-

On the day of execution, all the prisoners will be made to stand in a straight line such that one prisoner stands just behind one another and so on. All the prisoners will be wearing a hat either blue or red color. The prisoners will not know what color hat they are wearing. The last prisoner can see all the prisoners standing in front of him. The first prisoner cannot see anything.

The executioner will ask each prisoner what color of hat they are wearing one by one starting from the last in the line. The prisoners are allowed to speak only red or blue. If the prisoner gets it he lives otherwise shot. All the others can hear the answer and gunshots.

Assuming that the prisoners are smart, what strategy would the prisoners make at the night to minimize the number of deaths.

Prisoner hat problem -Verzeo

The strategy is that the last prisoner will say ‘red’ if the number of red hats in front of him is odd and ‘blue’ if the number of red hats is even. Now, the 99th guy will see if the red hats in front of him are odd or even. If it is odd then obviously the hat above him is blue, else it is red. From now one, it is intuitive

Question 5

You are in a dark room where a table is kept. There are 50 coins placed on the table, out of which 10 coins are showing tails and 40 coins are showing heads. The task is to divide this set of 50 coins into 2 groups such that both groups have the same number of coins showing the tails.

Flip coin problem -Verzeo

Divide the group into two groups of 40 coins and 10 coins. Flip all the coins of the group with the 10 coins.

Question 6

N people are standing in the circle. They are labelled from 1 to N in clockwise order, every one of them is holding a gun and can shoot a person on his left. Starting from person 1, they start shooting in order. For example, if N=100, 1 shoots 2, 3 shoots 4, and so on till one survives. What is the index of the last person?

N people in circle with gun problem - Verzeo

We write in binary if N= 100 then in binary which is 1100100 and then we take the complement which is 11011 and it is 27. We subtract the complement from the original number so 100-27= 73.

For the number in form 2^n, it will be the first person. For example,


Complement =111111=63

64-63= 1

So you can apply this in any ‘n’.

Question 7

There are 100 black socks and 100 white socks mixed up in a drawer. If you have to pick socks blindly from the drawer, how many socks do you need to take out to be sure that you have a matching pair of socks?

Black white socks problem - Verzeo

We must note that they are asking for a matching pair of socks and not a specific colour, we must think thoroughly.

3 socks are the minimum number of socks that need to be pulled out for it to be a matching pair.

If we take out three socks from the drawer blindly, the combinations that can come out can be WWB, WBB, WWW, BWW, BBW, BBB, where B and W are black and white socks respectively. Therefore picking 3 socks from the drawer must get us either black or white socks.

Question 8

There are 9 balls which weigh the same except for one, which is heavier than the others. What is the minimum number of weighings you should perform in order to find the ball with a higher weight?

9 balls weight problem - Verzeo

Let us name the balls 1, 2, 3, 4, and so on. Now we weigh 1,2,3 vs 4,5,6.

If these balance out the heavier balls are 789. In this case, we weigh 7 vs 8 if these balances then 9 is the heaviest ball if not then either 7 or 8.

If they do not balance out then the heavier side has the oddball. Assuming the 123 weighs heavier than 456 then we weigh 1 vs 2. If they balance out 3 is the heaviest ball, if not either 1 or 2.

Therefore, we would need to take a minimum of 2 weighings to get the right answer.

Question 9

There are two jars with 50 red and 50 blue marbles. You need to place all the marbles into the jars in such a way that if you blindly pick one marble out of the jar, there are maximum chances of it being red. While picking, you will first randomly pick a marble out from the first jar and then randomly pick a marble out from the second jar. You can arrange the marble however you like, but each marble must be in a jar.

marbles in jar problem - Verzeo

Let's put a single red marble in one jar and the rest of the marble in another jar, there is at least a 50% chance of getting a red marble since one marble picked at random, doesn’t leave any room for choice. Now there are 49 red marbles and 50 blue marbles and nearly even chance of picking a red marble 49 out of 99. When we calculate the total probability:-

P(red marble)= P(J1)*P(red marble in J1)+P(J2)*P(red marbles in J2)

P(red marble)= 0.5*1+0.5*49/99

P(red marble)= 0.7474


Thus, we end up with the chance of -75% of picking up the red marble.

Question 10

At a party, everyone shook hands with each other. There were 66 handshakes. How many people were at the party?

Bus problem - Verzeo

Let the number of handshakes be N.

If there are n+1 people.



So there were 12 people at the party.

Question 11

There is a bus with 100 labelled seats all are labelled from 1 to 100. 100 people are standing in a queue. All those people are also labelled 1 to 100. People board on the bus in sequence from 1 to n. The rule is if a person ‘a’ boards the bus, he checks if ‘a’ is empty. If it is empty, he sits there otherwise he randomly picks an empty seat and sits there. Find the probability that the 100th person sits on his place i.e 100th seat.

Problem -Verzeo

First, we observe that the fate of the last person is determined by either the first person or the last seat is selected. This is because the last person will either get the first seat or the last seat. Any other seat will necessarily be taken by the time the last guy gets to choose.

Since at each choice step. The first or last is equally probable to be taken, the last person will get either the first or last equal probability which is ½.

Question 12

4 glasses are placed on the corner of a square Lazy Susan ( a square plate which can rotate about its center. Some of the glasses are upright and some are upside down. A blindfolded person is seated next to the Lazy Susan and is required to re-arrange the glasses so that they are either all up or all down. The glasses may be rearranged in turns with subject to the following rules. Any two glasses may be inspected in one turn and after feeling the orientation the person may reverse the orientation of either, neither, or both glasses. After each turn, the Lazy Susan is rotated at random angles.

The puzzle is to devise an algorithm that allows the blindfolded person to ensure that all the glasses have the same orientation in a finite number of turns.

Glass problem -Verzeo

Let us take our algorithm as follows:-

  • On the first turn, we choose a diagonally opposite pair of glasses and turn both glasses up.
  • On the second turn, we choose two adjacent glasses at least one will be up as a result of the previous step. If the other comes down, turn it up as well. If the bell does not ring, then there are 3 glasses up and 1 down.
  • On the third turn, we choose a diagonally opposite pair of glasses. If one is down, turn it up and the bell will ring. If both are up, turn one down, there are now two glasses down, and they must be adjacent.
  • On the fourth turn, we choose two adjacent glasses and reverse both of them, if both were on the same orientation then the bell will ring if not then there are now two glasses down and they must be diagonally opposite.
  • On the fifth turn, we choose diagonally opposite pairs of glasses and reverse both. The bell will ring.

Question 13

Consider a unit sphere. 4 points are randomly chosen on it, what is the probability that the center of the sphere lies within the tetrahedron (/ polygon) formed by those 4 points?

Sphere problem - Verzeo

Let A, B, C be random points on the sphere with Aa, Bb, Cc being diameters

The spherical triangle abc is common to the hemisphere abc, bca and cab ( where the notation abc represents the hemisphere cut off by the great circle through a and b containing the point c, etc), therefore the probability of that a further random point D, lies on this triangle is:

½*½*½= ⅛

For the center to lie in the tetrahedron D should lie in the triangle in the opposite hemisphere of ABC.

Question 14

In a country in which people only want boys, every family continues to have children until they have a boy. If they have a girl, they have another child. If they have a boy they stop. What is the proportion of boys to girls in the country?

The following is the required calculation for the answer:

Expected number of boys for 1 family= 1*(probability of 1 boy)+1*(probability of 1 girl and a boy)+1*(probability of 2 girls and a boy).....

For C couples= 1*(C*½)+1*(c*½*½)+1*(C*½*½*½)+......

Expected number of boys= C/2+C/4+C/8+C/16…..

Expected number of boys= C

Expected number of girls in 1 family= 0*(probability of 0 girls)+1*(probability of 1 girl and a boy)+ 2*(probability of 2 girls and a boy).....

For C couples= 0*( c+½)+1*(C*½*½)+2*(C*½*½*½).....

Expected number of girls= 0+C/4+2*C/8+3*C/16….

Expected number of girls = C

Therefore, the proportion is C/C= 1:1

Question 15

You and your friend are caught by the mafia and made to play a game to determine if you live or die. The game is simple, there is a deck of cards and you both have to choose a card. You can look at each other’s cards but not at the card you have chosen. You both will survive if both are correct in guessing the card they have chosen. Otherwise, both die.

What is the probability of you surviving if you and your friend play the game optimally?

Let the two friends be A, B respectively:

We know that A and B have picked a card at random from a deck of cards. A can see B’s card and vice versa. So, A knows he has not picked B’s card but apart from that, he knows that the card is equally probable to be any of the 51 cards. So, if A guesses B’s card they lose. But if A guesses any other card, there’s a probability of 1/51 chance that A is right.

A’s aim now is to tell any card apart from B’s card that gives B the most information about B’s card. So they can plan as follows:

  • Consider the sequence of cards clubs 1-13, diamonds 1-13, hearts 1-13, spades 1-13. A will tell the card after B’s card in this sequence.
  • With A’s guess, which is always different from B’s card, B gets to know exactly which card he has and can always guess correctly. So the probability of success is 1/51, which is the maximum number achievable.


So those were some top 15 data science puzzle interview questions. I hope that these questions had made you think hard. Now imagine sitting in an interview and answering them without going through them prior to the interview. This will surely put you in a lot of pressure.

I hope you found these list of interview puzzles informative enough.

If you wish to learn data science through an Internship click here or you can also checkout Verzeo’s pro-degree data science certification program.