If you ever go for an interview, prepare well for puzzles and guess estimate questions. They’d surely be thrown at you. Sometimes, the puzzles appear to be difficult, but the solutions turns out to be extremely simple. I’ve got stumbled many a times by such questions. But, over the years, I’ve learned the art of solving such tricky puzzles.

Here’s the secret to solve them. Be Logical. That’s it. You need nothing else, no qualification, no reputed degree to solve them. Such questions are meant to test your common sense and logical aptitude. Don’t think too hard decoding the logic behind them, but think out of the box. Think smart.

In this article, I have chosen 3 most challenging puzzles which most people get wrong in interviews. Since these questions are tricky to understand at first, it’s alright even if you do not find their answer in first attempt. But don’t give up easily.

None of these puzzles have been crafted by me. But, the solutions provided are my own solutions. These puzzle might possibly have more than one solution. I’d suggest you to explore them from all possible directions. Do share your solutions in the comments section below.

*Puzzles are just one part of the entire data science interview process. There’s a whole lot more that goes into landing your first role in data science. Check out the ‘Ace Data Science Interviews‘ course where we provide tons of materials including videos and resources (cheatsheets, checklists, a MASSIVE interview book) to help you land your first data science role.*

In order to evaluate your progress, I’ve created a score chart. Here is marking sheet for these puzzles :

*Maximum score on each puzzle : 10*

*Unattempted puzzle : 0 marks*

*Puzzle solved but with wrong answer : 1 – 5 marks (self assessment)*

*Right answer but methodology not very clear : 6 – 8 marks (self assessment)*

*Right answer and right methodology : 9 marks*

*Right answer solved using multiple methodology : 10 marks*

Once you have score for all three, add them up and get a score out of 30. In case you know a puzzle : skip it and scale your score to a base of 30. With this score map your self from the following table :

Score 1 - 10 : Beginner - You need Practice

Score 11 - 20 : Moderate - You already have the skill set, you can improve through more practice

Score 21 - 26 : Highly skilled - You are born to be a data scientist

Score 27 - 28 : Exceptionally skilled - You need to start teaching other data scientists

Score 29 - 30 : Wow - You are a champion. You need to publish all your approaches in the commend box below.

*Note: Be true to yourself in scoring.*

Here we go with the puzzles :

Ten people land on a deserted island. There they find lots of coconuts and a monkey. During their first day they gather coconuts and put them all in a community pile. After working all day they decide to sleep and divide them into ten equal piles the next morning.

That night one castaway wakes up hungry and decides to take his share early. After dividing up the coconuts he finds he is one coconut short of ten equal piles. He also notices the monkey holding one more coconut. So he tries to take the monkey’s coconut to have a total evenly divisible by 10. However when he tries to take it the monkey conks him on the head with it and kills him.

Later another castaway wakes up hungry and decides to take his share early. On the way to the coconuts he finds the body of the first castaway, which pleases him because he will now be entitled to 1/9 of the total pile. After dividing them up into nine piles he is again one coconut short and tries to take the monkey’s slightly bloodied coconut. The monkey conks the second man on the head and kills him.

One by one each of the remaining castaways goes through the same process, until the 10th person to wake up gets the entire pile for himself. What is the smallest number of possible coconuts in the pile, not counting the monkeys?

*Answer : 2519*

**Logic:** LCM (Lowest Common Multiple) of 10,9,8,7,6,5,4,3,2,1 -1. LCM would give the least number which is divisible by all of these number and subtracting one would give us the number of coconuts which were initially there.

A stark raving mad king tells his 100 wisest men he is about to line them up and he will place either a red or blue hat on each of their heads. Once lined up, they must not communicate amongs themselves. Nor may they attempt to look behind them or remove their own hat.

The king tells the wise men that they will be able to see all the hats in front of them. They will not be able to see the color of their own hat or the hats behind them, although they will be able to hear the answers from all those behind them.

The king will then start with the wise man in the back and ask “what color is your hat?” The wise man will only be allowed to answer “red” or “blue,” nothing more. If the answer is incorrect then the wise man will be silently killed. If the answer is correct then the wise man may live but must remain absolutely silent.

The king will then move on to the next wise man and repeat the question.

The king makes it clear that if anyone breaks the rules then all the wise men will die, then allows the wise men to consult before lining them up. The king listens in while the wise men consult each other to make sure they don’t devise a plan to cheat. To communicate anything more than their guess of red or blue by coughing or shuffling would be breaking the rules.

What is the maximum number of men they can be guaranteed to save?

**Answer : 99.**

The first wise man counts all the red hats he can see (**A**) and then answers “blue” if the number is odd or “red” if the number is even. Each subsequent wise man keeps track of the number of red hats known to have been saved from behind (**B**), and counts the number of red hats in front (**C**).

If A was even, and if B&C are either both even or are both odd, then the wise man would answer blue. Otherwise the wise man would answer red.

If A was odd, and if B&C are either both even or are both odd, then the wise man would answer red. Otherwise the wise man would answer blue.

A king wants his daughter to marry the smartest of 3 extremely intelligent young Prince, and so the king’s wise men devised an intelligence test.

All the prince are gathered into a room and seated, facing one another, and are shown 2 black hats and 3 white hats. They are blindfolded, and 1 hat is placed on each of their heads, with the remaining hats hidden in a different room.

The king tells them that the first prince to deduce the color of his hat without removing it or looking at it will marry his daughter. A wrong guess will mean death. The blindfolds are then removed.

You are one of the prince. You see 2 white hats on the other prince’s heads. After some time you realize that the other prince are unable to deduce the color of their hat, or are unwilling to guess. What color is your hat?

**Note:** You know that your competitors are very intelligent and want nothing more than to marry the princess. You also know that the king is a man of his word, and he has said that the test is a fair test of intelligence and bravery.

**Answer : White.**

The king would not select two white hats and one black hat. This would mean two prince would see one black hat and one white hat. You would be at a disadvantage if you were the only prince wearing a black hat.

If you were wearing the black hat, it would not take long for one of the other princes to deduce he was wearing a white hat.

If an intelligent prince saw a white hat and a black hat, he would eventually realize that the king would never select two black hats and one white hat. Any prince seeing two black hats would instantly know he was wearing a white hat. Therefore if a prince can see one black hat, he can work out he is wearing white.

Therefore the only fair test is for all three prince to be wearing white hats. After waiting some time just to be sure, you can safely assert you are wearing a white hat.

I hope you scored 27 + . In case you did, we will love to hear your solutions. Write your score and your solutions in the comment section below. Make sure you bring out, what challenge did you face and how did you think around the challenge.

Did you find this article useful ? Share your views and opinions in the comments section below.

As you mentioned " If the answer is incorrect then the wise man will be silently killed", if the wise man silently killed, which means no one in the front knows that who were killed or who were survived. So, they will not be able to know calculation of B in your answer "Each subsequent wise man keeps track of the number of red hats known to have been saved from behind (B)". May be, in the question you need to change the fact that if any of the people get killed, the other people known that they were killed, so that they know whether their answer is right or wrong.

Puzzle 2 – Hat Riddle For the puzzle two, the other solution may be as below, The wise men discuss among themselves such that the last one in the line will see and tell the color of the man standing before him. As this continues 99 men will guaranteed to be saved. If there is a chance of 99th and 100th men are wearing the same colored hat, the last men as well would be saved :).

The hat problem can be solved in another way-the first man has to give an answer at random but if the hat on the next person is blue,he will reply immediately,but if the next hat is red he will reply to the king's question after a long time(suppose 10 seconds).this way the next person will get to know his hat and he will say his color either immediately or after some time depending upon the next person's hat color.