How to Solve Analytics Interview Puzzles

Analytics jobs require a lot of problem solving and out of the box thinking. Hence, puzzles, logical reasoning problems and questions to test lateral thinking are important part of most analytics job interviews. But not all puzzles are alike. Some are more technical, some are straight forward (if you know the answer you can solve it) and some are just unsolvable- interviwer is probably trying to test your approach or patience. But to succeed, you must be prepared for all such scenarios. You may also be asked to create algorithms for each of these cases. Here’s how to crack them:

1. Focus on the data provided– usually interview puzzles involve just one or two steps of calculations.
2. Develop a structured appraoch to answer difficult puzzles
3. Be able to explain your appraoch to the interviewer

I’ll explain with some examples how to master puzzle solving for interviews with one technical, one straight forward and one doubtful puzzle.

Puzzles with an Approach:

1. A race track has 5 lanes. There are 25 horses and one would like to find out the 3 fastest horses. What is the minimum number of races one would need to conduct to determine the 3 fastest horses?

This is a common puzzle asked by many interviewers. The steps are:

Create 5 groups of 5 horses each and conduct five races (1 for each group) and pick up the fastest horse from each group.
The sixth race will be among the 5 winners to find out the 3 fastest horses (mark them A1, B1 and C1)
Seventh race will be among the horses B1, C1, second and third horse from the horse A1’s group (A2, A3), second horse from horse B1’s group (B2).

The 1st and 2nd position holders in the 7th race are the 2nd and the 3rd fastest horses among all horses.

The logic is simple. By conducting the race among 5 winning horses we can find out the fastest horse but we don’t know for sure whether the second fastest horse in that race is faster than the second horse in the fastest horse’s group. So, in the final race we have to include all probable candidates and conduct the race.

Similar puzzles can be asked for finding out the heaviest coin in among N number of coins. And the trick is to single out the one in lowest number of steps. The approach to such problems are to:

  • Divide all the members into X groups and maximize number of members in each group. In this case we could have just 5 horses in each group as there were 5 lanes.
  • Shortlist the members from each group and make them compete among themselves (if required form the groups again) and iterate the first step until the problem is solved.
  • Develop a structured appraoch to answer difficult puzzles

The Straightforward Puzzle

In many cases interviewer expect you to know the answer but in case you don’t you should apply simple logic and explain your approach. I’ll site 3 examples here (mostly related to data science and analytics):
1. You have 3 jars that are all mislabeled. One jar contains Apple, another contains Oranges and the third jar contains a mixture of both Apple and Oranges.
You are allowed to pick as many fruits as you want from each jar to fix the labels on the jars. What is the minimum number of fruits that you have to pick and from which jars to correctly label them?
Solution
An interesting point in these kind of puzzles is there is a circular misplacement. Which means if Apple is wrongly labelled as Apple, Apple can’t be labelled as Orange- it has to be labelled as A+O.
Now, to answer this question in minimum steps, try to reverse engineer the problem. You know everything is wrongly placed. Which means the A+O jar contains either Apple or Orange (but not both). So, just pick one fruit from A+O and let’s say you get an Apple. Name it Apple. As discussed above, jar labelled Apple can’t have A+O. So it can be labelled Orange. The third jar left should be labelled as A+O.
So you can answer the question by just picking one fruit.
2. You have a flashlight that takes 2 working batteries. You have 8 batteries but only 4 of them work.
What is the fewest number of pairs you need to test to guarantee you can get the flashlight on?
Solution
Let’s say the batteries are A, B, C, D, E, F, G and H
This is somewhat similar to the horse problem discussed in beginning. Except for the fact that we can’t compare 2 items directly. If a combination of two batteries can’t light the torch either or both can be not working. So we have to try out in a circular way first.
Try AB, BC and AC. If none of the pairs work at most one out of ABC is working.
Which means at least three batteries among DEFGH must be working.
Try DE. If they do not work then at least two out of FGH should work.
Try FG, GH and FH and you’ll find out two working batteries.
3. You are blindfolded and 10 coins are place in front of you on table. You are allowed to touch the coins, but can’t tell which way up they are by feel. You are told that there are 5 coins head up, and 5 coins tails up but not which ones are which. How do you make two piles of coins each with the same number of heads up? You can flip the coins any number of times.
Solution
Randomly select 5 coins and make a pile. Make another pile with 5 other coins.
First pile would look like, say H, H, H, H, T
The other pile should be: T, T, T, T, H
So, now, if you just flip all coins in the second pile and both will have same number of heads.
The Complicated Puzzle<>
The third type of puzzles are the doubtful ones and interviewer might ask you such question only to check your ability to support your answers with reasons.
A famous problem of this type is Monty Hall problem (Here’s a link to the answer for Monty Hall.). Just keep your calm while answering such problems and be reasonable.

Monty Hall Problem

https://www.quora.com/What-are-some-brain-storming-puzzle-questions-asked-in-a-data-scientist-analyst-interview

Commonly asked puzzles in analytics interviews


https://www.quora.com/What-s-the-hardest-puzzle-question-asked-at-PayPal

Leave a Reply

Your email address will not be published.