0% found this document useful (0 votes)
241 views47 pages

Technical Interview Puzzles

The king has a clever plan to identify the poisoned wine bottle among 1000 bottles while only risking 10 prisoners' lives. He will number the bottles in binary representation and have each of 10 prisoners drink from bottles corresponding to their bit place value. For example, prisoner 1 drinks bottles with a 1 in the least significant bit, prisoner 2 those with a 1 in the next place value, and so on. This allows the king to identify the single poisoned bottle by seeing which prisoners get sick, without wasting more than 10 prisoners.

Uploaded by

Izuku Midoriya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
241 views47 pages

Technical Interview Puzzles

The king has a clever plan to identify the poisoned wine bottle among 1000 bottles while only risking 10 prisoners' lives. He will number the bottles in binary representation and have each of 10 prisoners drink from bottles corresponding to their bit place value. For example, prisoner 1 drinks bottles with a 1 in the least significant bit, prisoner 2 those with a 1 in the next place value, and so on. This allows the king to identify the single poisoned bottle by seeing which prisoners get sick, without wasting more than 10 prisoners.

Uploaded by

Izuku Midoriya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

1) Camel and Bananas Puzzle

Puzzle:
The owner of a banana plantation has a camel. He wants to transport his 3000 bananas to the market, which is
located after the desert. The distance between his banana plantation and the market is about 1000 kilometer. So
he decided to take his camel to carry the bananas. The camel can carry at the maximum of 1000 bananas at a
time, and it eats one banana for every kilometer it travels.

What is the most bananas you can bring over to your destination?
Solution:
First of all, the brute-force approach does not work. If the Camel starts by picking up the 1000 bananas and try
to reach point B, then he will eat up all the 1000 bananas on the way and there will be no bananas left for him
to return to point A.

So we have to take an approach that the Camel drops the bananas in between and then returns to point A to
pick up bananas again.

Since there are 3000 bananas and the Camel can only carry 1000 bananas, he will have to make 3 trips to carry
them all to any point in between.

<---p1---><--------p2-----><-----p3---->
A---------------------------------------->B

When bananas are reduced to 2000 then the Camel can shift them to another point in 2 trips and when the
number of bananas left are <= 1000, then he should not return and only move forward.

In the first part, P1, to shift the bananas by 1Km, the Camel will have to
1. Move forward with 1000 bananas – Will eat up 1 banana in the way forward
2. Leave 998 banana after 1 km and return with 1 banana – will eat up 1 banana in the way back
3. Pick up the next 1000 bananas and move forward – Will eat up 1 banana in the way forward
4. Leave 998 banana after 1 km and return with 1 banana – will eat up 1 banana in the way back
5. Will carry the last 1000 bananas from point a and move forward – will eat up 1 banana
Note: After point 5 the Camel does not need to return to point A again.

So to shift 3000 bananas by 1km, the Camel will eat up 5 bananas.

After moving to 200 km the Camel would have eaten up 1000 bananas and is now left with 2000 bananas.

Now in the Part P2, the Camel needs to do the following to shift the Bananas by 1km.

1. Move forward with 1000 bananas – Will eat up 1 banana in the way forward
2. Leave 998 banana after 1 km and return with 1 banana – will eat up this 1 banana in the way back
3. Pick up the next 1000 bananas and move forward – Will eat up 1 banana in the way forward
Note: After point 3 the Camel does not need to return to the starting point of P2.
So to shift 2000 bananas by 1km, the Camel will eat up 3 bananas.

After moving to 333 km the camel would have eaten up 1000 bananas and is now left with the last 1000
bananas.

The Camel will actually be able to cover 333.33 km, I have ignored the decimal part because it will not make a
difference in this example.

Hence the length of part P2 is 333 Km.

Now, for the last part, P3, the Camel only has to move forward. He has already covered 533 (200+333) out of
1000 km in Parts P1 & P2. Now he has to cover only 467 km and he has 1000 bananas.

He will eat up 467 bananas on the way forward, and at point B the Camel will be left with only 533 Bananas.

****************************************************************

2) Ant and Triangle Problem


Question:

Three ants are sitting at the three corners of an equilateral triangle. Each ant starts randomly picks a direction
and starts to move along the edge of the triangle. What is the probability that none of the ants collide?

Answer:
So let’s think this through. The ants can only avoid a collision if they all decide to move in the same direction
(either clockwise or anti-clockwise). If the ants do not pick the same direction, there will definitely be a
collision. Each ant has the option to either move clockwise or anti-clockwise. There is a one in two chance that
an ant decides to pick a particular direction. Using simple probability calculations, we can determine the
probability of no collision.

P(No collision) = P(All ants go in a clockwise direction) + P( All ants go in an anti-clockwise direction) = 0.5
* 0.5 * 0.5 + 0.5 * 0.5 * 0.5 = 0.25
****************************************************************

3) Crossing the Bridge Puzzle


Puzzle: Four people need to cross a rickety bridge at night. Unfortunately, they have only one torch and the
bridge is too dangerous to cross without one. The bridge is only strong enough to support two people at a time.
Not all people take the same time to cross the bridge. Times for each person: 1 min, 2 mins, 7 mins and 10
mins. What is the shortest time needed for all four of them to cross the bridge?
Puzzle Solution:
It is 17 mins.
1 and 2 go first, then 1 comes back. Then 7 and 10 go and 2 comes back. Then 1 and 2 go again, it makes a
total of 17 minutes.

****************************************************************

4) Burning Rope Timer Puzzle


Puzzle:
A man has two ropes of varying thickness (Those two ropes are not identical, they aren’t the same density nor
the same length nor the same width). Each rope burns in 60 minutes. He actually wants to measure 45 mins.
How can he measure 45 mins using only these two ropes.
He can’t cut the one rope in half because the ropes are non-homogeneous and he can’t be sure how long it will
burn.

Solution:
He will burn one of the rope at both the ends and the second rope at one end. After half an hour, the first one
burns completely and at this point of time, he will burn the other end of the second rope so now it will take 15
mins more to completely burn. so total time is 30+15 i.e. 45mins.

****************************************************************

5) Heaven or Hell Puzzle


Problem: You are standing before two doors. One of the path leads to heaven and the other one leads to hell.
There are two guardians, one by each door. You know one of them always tells the truth and the other always
lies, but you don’t know who is the honest one and who is the liar.
You can only ask one question to one of them in order to find the way to heaven. What is the question?

This is one of the classic puzzles asked in Infosys interview.

Solution:
The question you should ask is “If I ask the other guard about which side leads to heaven, what would he
answer?”. It should be fairly easy to see that irrespective of whom do you ask this question, you will always
get an answer which leads to hell. So you can chose the other path to continue your journey to heaven.

This idea was famously used in the 1986 film Labyrinth.

Here is the explanation if it is yet not clear.

Let us assume that the left door leads to heaven.


If you ask the guard which speaks truth about which path leads to heaven, as he speaks always the truth, he
would say “left”. Now that the liar , when he is asked what “the other guard (truth teller) ” would answer, he
would definitely say “right”.

Similarly, if you ask the liar about which path leads to heaven, he would say “right”. As the truth teller speaks
nothing but the truth, he would say “right” when he is asked what “the other guard( liar ) ” would answer. So
in any case, you would end up having the path to hell as an answer. So you can chose the other path as a way
to heaven.

****************************************************************

6) 10 Coins Puzzle
Problem: 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.
This puzzle was asked in Yahoo Interview.
Solution:
Make 2 piles with equal number of coins. Now, flip all the coins in one of the pile.

How this will work? lets take an example.

So initially there are 5 heads, so suppose you divide it in 2 piles.

Case:

P1 : H H T T T
P2 : H H H T T
Now when P1 will be flipped
P1 : T T H H H

P1(Heads) = P2(Heads)

Another case:

P1 : H T T T T
P2 : H H H H T
Now when P1 will be flipped
P1 : H H H H T

P1(Heads) = P2(Heads)

****************************************************************
7) King and Wine Bottles
Problem:
A bad king has a cellar of 1000 bottles of delightful and very expensive wine. A neighboring queen plots to
kill the bad king and sends a servant to poison the wine. Fortunately (or say unfortunately) the bad king’s
guards catch the servant after he has only poisoned one bottle. Alas, the guards don’t know which bottle but
know that the poison is so strong that even if diluted 100,000 times it would still kill the king. Furthermore, it
takes one month to have an effect. The bad king decides he will get some of the prisoners in his vast dungeons
to drink the wine. Being a clever bad king he knows he needs to murder no more than 10 prisoners – believing
he can fob off such a low death rate – and will still be able to drink the rest of the wine (999 bottles) at his
anniversary party in 5 weeks time. Explain what is in mind of the king, how will he be able to do so ? (of
course he has less then 1000 prisoners in his prisons)

Solution:
Think in terms of binary numbers. (now don’t read the solution, give a try).

Number the bottles 1 to 1000 and write the number in binary format.

bottle 1 = 0000000001 (10 digit binary)

bottle 2 = 0000000010

bottle 500 = 0111110100

bottle 1000 = 1111101000

Now take 10 prisoners and number them 1 to 10, now let prisoner 1 take a sip from every bottle that has a 1 in
its least significant bit. Let prisoner 10 take a sip from every bottle with a 1 in its most significant bit. etc.

prisoner = 10 9 8 7 6 5 4 3 2 1

bottle 924 = 1 1 1 0 0 1 1 1 0 0

For instance, bottle no. 924 would be sipped by 10,9,8,5,4 and 3. That way if bottle no. 924 was the poisoned
one, only those prisoners would die.
After four weeks, line the prisoners up in their bit order and read each living prisoner as a 0 bit and each dead
prisoner as a 1 bit. The number that you get is the bottle of wine that was poisoned.
1000 is less than 1024 (2^10). If there were 1024 or more bottles of wine it would take more than 10 prisoners.

****************************************************************

8) 3 Mislabeled Jars
Problem:
This problem is also called Jelly Beans problem. This is the most commonly asked interview puzzle.

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?

Labels on jars are as follows:

Solution:
Let’s take a scenario. Suppose you pick from jar labelled as Apple and Oranges and you got Apple from it.
That means that jar should be Apple as it is incorrectly labelled. So it has to be Apple jar.
Now the jar labelled Oranges has to be Mixed as it cannot be the Oranges jar as they are wrongly labelled and
the jar labelled Apple has to be Oranges.

Similar scenario applies if it’s a Oranges taken out from the jar labelled as Apple and Oranges. So you need to
pick just one fruit from the jar labelled as Apple and Oranges to correctly label the jars.

****************************************************************

9) Red and Blue Marbles


Problem:
You have two jars, 50 red marbles and 50 blue marbles. You need to place all the marbles into the jars such
that when you blindly pick one marble out of one jar, you maximize the chances that it will be red. When
picking, you’ll first randomly pick a jar, and then randomly pick a marble out of that jar. You can arrange the
marbles however you like, but each marble must be in a jar.
Answer:
Say we put all the red marbles into JAR A and all the blue ones into JAR B. then our chances for picking a red
one are:
1/2 chance we pick JAR A * 50/50 chance we pick a red marble
1/2 chance we pick JAR B * 0/50 chance we pick a red marble

You would try different combinations, such as 25 of each colored marble in a jar or putting all red marbles in
one jar and all the blue in the other. You would still end up with a chance of 50%.

What if you put a single red marble in one jar and the rest of the marbles in the other jar? This way, you are
guaranteed at least a 50% chance of getting a red marble (since one marble picked at random, doesn’t leave
any room for choice). Now that you have 49 red marbles left in the other jar, you have a nearly even chance of
picking a red marble (49 out of 99).
So the maximum probability will be :
jar A : (1/2)*1 = 1/2 (selecting the jar A = 1/2, red marble from jar A = 1/1)
jar B : (1/2)*(49/99) = 0 (selecting the jar B = 1/2, red marble from jar B = 49/99)
Total probability = 74/99 (~3/4)

****************************************************************

10) Gold Bar Puzzle


Problem:
You’ve got someone working for you for seven days and a gold bar to pay him. The gold bar is segmented into
seven connected pieces. You must give them a piece of gold at the end of every day. What and where are the
fewest number of cuts to the bar of gold that will allow you to pay him 1/7th each day?
Solution:
Lets split the chain as,
1,2,4 (3 parts)
Day 1: Give A (+1)
Day 2: Get back A, give B (-1, +2)
Day 3: Give A (+1)
Day 4:Get back A and B, give C (-2,-1,+4)
Day 5:Give A (+1)
Day 6:Get back A, give B (-1,+2)
Day 7:Give A (+1)

Trick: Whenever it is said that you have to measure 15kg and minimum number of weights
required for this?

Then always start with 2^0 and go to less than 15 i.e. {1,2,4,8}. Hence these four weights can
measure any weight from 1-15 kg.

****************************************************************

11) 100 Doors Puzzle


Problem :
You have 100 doors in a row that are all initially closed. you make 100 passes by the doors starting with the
first door every time. the first time through you visit every door and toggle the door (if the door is closed, you
open it, if its open, you close it). the second time you only visit every 2nd door (door #2, #4, #6). the third
time, every 3rd door (door #3, #6, #9), ec, until you only visit the 100th door.

What state are the doors in after the last pass? Which are open which are closed?

Puzzle asked in: Google/Adobe/Amazon/Oracle


Solution:
You can figure out that for any given door, say door #38, you will visit it for every divisor it has. so has 1 &
38, 2 & 19. so on pass 1 i will open the door, pass 2 i will close it, pass 19 open, pass 38 close. For every pair
of divisors the door will just end up back in its initial state. so you might think that every door will end up
closed? well what about door #9. 9 has the divisors 1 & 9, 3 & 3. but 3 is repeated because 9 is a perfect
square, so you will only visit door #9, on pass 1, 3, and 9… leaving it open at the end. only perfect square
doors will be open at the end.

Doors opened: 1,4,9,16,25,36,49,64,81,100 = 10 doors

****************************************************************

12) Red and Blue Balls in a Bag


Problem:
You have 20 Blue balls and 10 Red balls in a bag. You put your hand in the bag and take off two at a time. If
they’re of the same color, you add a Blue ball to the bag. If they’re of different colors, you add a Red ball to
the bag. What will be the color of the last ball left in the bag?

Note: Assume you have a big supply of Blue and Red balls for this purpose. When you take the two balls out,
you don’t put them back in, so the number of balls in the bag keeps decreasing.

Once you tackle that, what if there are 20 blue balls and 11 red balls to start with?

Solution:
There can be 3 possible cases taking off 2 balls from bag.
a) If we take off 1 Red and 1 Blue, in fact we will take off 1 Blue
b) If we take off 2 Red, in fact we will take off 2 Red (and add 1 Blue)
c) If we take off 2 Blue, in fact we will take off 1 Blue

So In case of (a) or (c), we are only take off one Blue ball. Also, we always take off Red balls two by two.

1) 20 Blue, 10 Red balls


If there are 10 (even) number of Red balls, we cannot have one single Red ball left in the bag, so the last ball
will be Blue.

2) 20 Blue, 11 Red balls


Now as the no. of Red balls is odd, there will be one single Red ball in the bag with other Blue balls, and
whenever we remove 1 Red and 1 Blue ball, we end up taking off only the Blue ball. So the Red ball will be
the last ball in the bag.
****************************************************************

13) Squares on a chess board?


Problem:
How many squares are on a chess board?

If you thought the answer is 64, think again!

How about all the squares that are formed by combining smaller squares on the chess board (2×2, 3×3, 4×4
squares and so on)?

A 1×1 square can be placed on the chess board in 8 horizontal and 8 vertical positions, thus making a total of 8
x 8 = 64 squares. Let’s consider a 2×2 square. There are 7 horizontal positions and 7 vertical positions in
which a 2×2 square can be placed. Why? Because picking 2 adjacent squares from a total of 8 squares on a
side can only be done in 7 ways. So we have 7 x 7 = 49 2×2 squares. Similarly, for the 3×3 squares, we have 6
x 6 = 36 possible squares. So here’s a break down.

1×1 squares= 8 x 8 = 64 squares


2×2 squares= 7 x 7 = 49 squares
3×3 squares= 6 x 6 = 36 squares
4×4 squares= 5 x 5 = 25 squares
5×5 squares= 4 x 4 = 16 squares
6×6 squares= 3 x 3 = 9 squares
7×7 squares= 2 x 2 = 4 squares
8×8 squares= 1×1 = 1 square

1^2 + 2^2 + 3^2 + . . . n ^2

Total = 64 + 49 + 36 + 25 + 16 + 9 + 4 + 1 = 204 squares


****************************************************************

14) Probability of having boy


In a country where everyone wants a boy, each family continues having babies till they have a boy.
After some time, what is the proportion of boys to girls in the country? (Assuming probability of
having a boy or a girl is the same)
Solution:

The proportion of boys to girls is 1 : 1 (Shocked?!!!!)


EXPLANATION-
This is a very simple probability question in a software interview. This question might be a little old to
be ever asked again but it is a good warm up.

Assume there are C number of couples so there would be C boys. The number of girls can be
calculated by the following method.

Number of girls = 0*(Probability of 0 girls) + 1*(Probability of 1 girl) + 2*(Probability of 2 girls) +



Number of girls = 0*(C*1/2) + 1*(C*1/2*1/2) + 2*(C*1/2*1/2*1/2) + …
Number of girls = 0 + C/4 + 2*C/8 + 3*C/16 + …
Number of girls = C
(using mathematical formulas; it becomes apparent if you just sum up the first 4-5 terms)

The proportion of boys to girls is 1 : 1.

****************************************************************

15) 13 Caves And A Thief Puzzle


Problem:
There are 13 caves arranged in a circle. There is a thief in one of the caves. Each day the thief can move to any
one of adjacent cave or can stay in same cave in which he was staying the previous day. And each day, cops
are allowed to enter any two caves of their choice.

What is the minimum number of days to guarantee in which cops can catch the thief?

Note:
Thief may or may not move to adjacent cave.
Cops can check any two caves, not necessarily be adjacent.
Solution (not confirmed):
Lets assume the thief is in cave C1 and going clockwise and cops start searching from cave C13 and C12 on
your first day.
Cave C13 and C11 on second day,
C13 and C10 on third day and so on till C13 and C1 on 12th day.
So basically the aim is to check C13 everyday so that if thief tries to go anti clockwise you immediately catch
it and if goes clockwise cops will catch him in maximum 12 days (this include the case where he remains in
Cave C1).

Answer is 12.
Another solution: one move clockwise another anti-clock, hence minimum days 7
****************************************************************
16) Prisoners and Hats Puzzle
Problem:
Four prisoners are arrested for a crime, but the jail is full and the jailer has nowhere to put them. He eventually
comes up with the solution of giving them a puzzle so if they succeed they can go free but if they fail they are
executed.

The jailer puts three of the men sitting in a line. The fourth man is put behind a screen (or in a separate room).
He gives all four men party hats. The jailer explains that there are two black and two white hats; that each
prisoner is wearing one of the hats; and that each of the prisoners is only to see the hats in front of them but not
on themselves or behind. The fourth man behind the screen can’t see or be seen by any other prisoner. No
communication between the prisoners is allowed.
If any prisoner can figure out and say to the jailer what color hat he has on his head all four prisoners go free.
If any prisoner suggests an incorrect answer, all four prisoners are executed. The puzzle is to find how the
prisoners can escape, regardless of how the jailer distributes the hats.

Solution:
Prisoner A and B are in the same situation – they have no information to help them determine their hat colour
so they can’t answer. C and D realise this.

Prisoner D can see both B and C’s hats. If B and C had the same colour hat then this would let D know that he
must have the other colour.

When the time is nearly up, or maybe before, C realises that D isn’t going to answer because he can’t. C
realises that his hat must be different to B’s otherwise D would have answered. C therefore concludes that he
has a black hat because he can see B’s white one.

****************************************************************

17) Age of 3 children – Mathematical Puzzle


Problem:
Two old friends, Jack and Bill, meet after a long time.
Jack: Hey, how are you man?
Bill: Not bad, got married and I have three kids now.
Jack: That’s awesome. How old are they?
Bill: The product of their ages is 72 and the sum of their ages is the same as your birth date.
Jack: Cool… But I still don’t know.
Bill: My eldest kid just started taking piano lessons.
Jack: Oh now I get it.
How old are Bill’s kids?

Solution:
This is a very good logical problem. To do it, first write down all the real possibilities that the number on that
building might have been. Assuming integer ages one get get the following which equal 72 when multiplied:

2, 2, 18 – sum = 22
2, 4, 9 – sum = 15
2, 6, 6 – sum = 14
2, 3, 12 – sum = 17
3, 4, 6 – sum = 13
3, 3, 8 – sum = 14
1, 8, 9 – sum = 18
1, 3, 24 – sum = 28
1, 4, 18 – sum = 23
1, 2, 36 – sum = 39
1, 6, 12 – sum = 19

The sum of their ages is the same as your birth date. That could be anything from 1 to 31 but the fact that Jack
was unable to find out the ages, it means there are two or more combinations with the same sum. From the
choices above, only two of them are possible now. For any other number, the answer is unique and the Jack
would have known after the second clue. So he asked for a third clue. The clue that the eldest kid just started
taking piano lessons is really just saying that there is an “oldest”, meaning that the younger two are not twins.

2, 6, 6 – sum(2, 6, 6) = 14
3, 3, 8 – sum(3, 3, 8 ) = 14

Hence, the answer is that the elder is 8 years old, and the younger two are both 3 years old.
The answer is 3, 3 and 8.
****************************************************************

18) Hats And IIT Students


The riddle is Nine IIT students were sitting in a classroom. Their professor wanted them to test. Next day the
professor told all of his 9 students that he has 9 hats, The hats either red or black color. He also added that he
has at least one hat with red color and the no. of black hats is greater than the no. of red hats. The professor
keeps those hats on their heads and ask them tell me how many red and black hats the professor have?
Obviously students can not talk to each other or no written communication, or looking into each other eyes; no
such stupid options and no tricks.
Professor goes out and comes back after 20 minutes but nobody was able to answer the question. So he gave
them 10 more minutes but the result was the same. So he decides to give them final 5 minutes. When he comes
everybody was able to answer him correctly.
So what is the answer? and why?
Answer:
After first interval of 20 minutes :
Lets assume that their is 1 hat of red color and 8 hats of black color. The student with red hat on his head can
see all 8 black hats, so he knows that he must be wearing a red hat.
Now we know that after first interval nobody was able to answer the prof that means our assumption is wrong.
So there can not be 1 red and 8 black hats.
After second interval of 10 minutes :
Assume that their are 2 hats of red color and 7 hats of black color. The students with red hat on their head can
see all 7 black hats and 1 red hat, so they know that they must be wearing a red hat.
Now we know that after second interval nobody was able to answer the prof that means our assumption is
again wrong. So there can not be 2 red and 7 black hats.
After third interval of final 5 minutes :
Now assume that their is 3 hats of red color and 6 hats of black color. The students with red hat on their head
can see all 6 black hats and 2 red hats, so they know that they must be wearing a red hat.
Now we know that this time everybody was able to answer the prof that means our assumption is right.So there
are 3 red hats and 6 black hats. Now as everybody gave the answer so there can be a doubt that only those 3
students know about it how everybody came to know ?
Then here is what i think, the professor gave them FINAL 5 minutes to answer, so other guys will think that
the professor expects the answer after 3rd interval (according to prof it must be solved after 3 intervals), so this
is the clue for others.
****************************************************************

19) Grandma and Cake – Logical Puzzle


Puzzle: You are on your way to visit your Grandma, who lives at the end of the valley. It’s her anniversary,
and you want to give her the cakes you’ve made. Between your house and her house, you have to cross 5
bridges, and as it goes in the land of make believe, there is a troll under every bridge! Each troll, quite rightly,
insists that you pay a troll toll. Before you can cross their bridge, you have to give them half of the cakes you
are carrying, but as they are kind trolls, they each give you back a single cake.
How many cakes do you have to leave home with to make sure that you arrive at Grandma’s with exactly 2
cakes?

Solution:
2 Cakes
How?
At each bridge you are required to give half of your cakes, and you receive one back. Which leaves you with 2
cakes after every bridge.

This is very cool interview puzzle.

****************************************************************

20) Handshake Problem


Problem:
At a party, everyone shook hands with everybody else. There were 66 handshakes. How many people were at
the party?
This question is asked in Infosys written.

Solution:
Lets say there are n persons
1st person shakes hand with everyone else: n-1 times(n-1 persons)
2nd person shakes hand with everyone else(not with 1st as its already done): n-2 times
3rd person shakes hands with remaining persons: n-3So total handshakes will be = (n-1) + (n-2) + (n-3) +……
0
= (n-1)*(n-1+1)/2 = (n-1)*n/2 = 66
= n^2 -n = 132
=(n-12)(n+11) = 0;
= n = 12 OR n =-11
-11 is ruled out so the answer is 12 persons.
****************************************************************

21) Riding Against the Wind Puzzle


Problem: A horse rider went a mile in 5 minutes with the wind and returned in 7 minutes against the wind.
How fast could he ride a mile if there was no wind?

Solution:
Most of us will proceed like that if a rider goes a mile in 2 minutes with the wind, and returns against the wind
in 3 minutes, that 2 and 3 equal 5, should give a correct average, so that time taken should be two and half
minutes. We find this answer to be incorrect, because the wind has helped him for only 2 minutes, while it has
worked adversely for 3 minutes.

If he could ride a mile in 2 minutes with the wind, it is clear that he could go a 1.5 mile 3 minutes, and 1 mile
in 3 minutes against the wind.

Therefore 2.5 miles in 6 minutes gives his actual speed, because the wind helped him just as much as it has
retarded him, so his actual speed for a single mile without any wind would be (2.5)/6 = 5/12 miles/sec

****************************************************************

22) Probability of getting one rupee coin from bag


Problem:
A bag contains (x) one rupee coins and (y) 50 paise coins. One coin is taken from the bag and put away. If a
coin is now taken at random from the bag, what is the probability that it is a one rupee coin?

Answers:
Case I: Let the first coin removed be one rupee coin One rupee coins left = (x – 1) Fifty paise coins left = y.
Probability of getting a one rupee coin in the first and second draw = x/(x + y) × (x – 1)/(x – 1 + y)
Case II: Let the first coin removed be fifty paise coin One rupee coins left = x Fifty paise coins left = y – 1.
Probability of getting a fifty paise coin in the first and one rupee coin in second draw
= y / (x + y) × x / (x + y – 1)
Total probability = sum of these two = x/(x + y) [after simplification].

****************************************************************

23) River Crossing Puzzle


Problem:
Sailor Cat needs to bring a wolf, a goat, and a cabbage across the river. The boat is tiny and can only carry one
passenger at a time. If he leaves the wolf and the goat alone together, the wolf will eat the goat. If he leaves the
goat and the cabbage alone together, the goat will eat the cabbage.
How can he bring all three safely across the river?

Solution:
The trick to this puzzle is that you can keep wolf and cabbage together. So the solution would be

The sailor will start with the goat. He will go to the other side of the river with the goat. He will keep goat
there and will return back and will take cabbage with him on the next turn. When he reaches the other side he
will keep the cabbage there and will take goat back with him.

Now we will take wolf and will keep the wolf at the other side of the river along with the cabbage. He will
return back and will take goat along with him. This way they all will cross the river.

****************************************************************

24) 3 Doors and Heaven


Problem:
A person dies, and he arrives at the gate to heaven. There are 3 doors in the heaven. One of the door leads to
heaven, second one leads to a 1-day stay at hell and then back to the gate and the third one leads to a 2 day stay
at hell and then back to the gate. Every time the person is back at the gate, the 3 doors are reshuffled. How
long will it take the person to reach heaven?

Solution:
According to probability 1/3 of the time, the door to heaven will be chosen, so 1/3 of the time it will take 0
days. 1/3 of the time, the 1-day door is chosen, of those, the right door will be chosen the next day. Similarly,
1/3 of the time, the 2 day door is chosen, of those, the right door will be chosen after the 2 days.

So lets say it will take N days. 1/3 of the cases are done in 0 days as before. 1/3 of the cases are 1+N. 1/3 are 2
+ N.
N = 1/3 * 0 + 1/3 * (1 + N) + 1/3 * (2 + N)
N = 1 + 2N/3
Therefore, N/3 = 1 ; N = 3.

So it will take on average 3 days to reach to heaven.

****************************************************************

25) How can four employees calculate the average of their


salaries without knowing other’s salary

This solution has a limitation that information is partially passed and there needs some trust level.

Salary of A: i

Salary of B: j

Salary of C: k

Salary of D: l

A passes to B (i + a) where a is a number that A knows B takes this a passes to C (i + j + a + b). C takes this
and passes to D (i + j + k + a + b + c). D takes this and passes to A (i + j + k + l + a + b + c + d)

Now one after another they remove their constants.


Ex: A now passes to B: i + j + k + l + b + c + d (He has removed a)

B passes to C after removing of his constant (b).

Thus Finally D gets x + y + z + u + d. He takes away his constant and now he has i + j + k + l.

So the average is:(i + j + k + l) / 4.

Let us know if you know any other solution.

Other solution:

Instead of each one passing a constant, only A can pass his salary + constant. Finally when D passes back the
total + constant to A again, then A can deduct the constant from the total and compute the average.
****************************************************************

26) Probability of picking 2 socks of same color


Problem :
There are 6 pairs of black socks and 6 pairs of white socks. What is the probability to pick a pair of black or
white socks when 2 socks are selected randomly in darkness.
This question was asked in Aamaon.

Solution:
Ways to pick any 2 socks from 24 socks = 24C2
Ways to pick 2 BLACK socks from 12 BLACK socks = 12C2

Probability of picking 2 BLACK socks (P1)= 12C2 / 24C2 = 66/276


Probability of picking 2 WHITE socks (P2)= 12C2 / 24C2 = 66/276

Probability of picking any 2 same color socks = P1+P2 = 66/276 + 66/276 = 11/23

****************************************************************

27) Blind bartender’s problem


Problem:
Four glasses are placed on the corners of a square table. Some of the glasses are upright (up) and some upside-
down (down). A blindfolded person is seated next to the table and is required to re-arrange the glasses so that
they are all up or all down, either arrangement being acceptable, which will be signalled by the ringing of a
bell. The glasses may be re-arranged in turns subject to the following rules. Any two glasses may be inspected
in one turn and after feeling their orientation the person may reverse the orientation of either, neither or both
glasses. After each turn the table is rotated through a random angle. The puzzle is to devise an algorithm which
allows the blindfolded person to ensure that all glasses have the same orientation (either up or down) in a finite
number of turns. The algorithm must be non-stochastic i.e. it must not depend on luck.

Solution:
 On the first turn choose a diagonally opposite pair of glasses and turn both glasses up.
 On the second turn choose two adjacent glasses. At least one will be up as a result of the previous step. If
the other is down, turn it up as well. If the bell does not ring then there are now three glasses up and one
down(3U and 1D).
 On the third turn 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 choose two adjacent glasses and reverse both. If both were in the same orientation then
the bell will ring. Otherwise there are now two glasses down and they must be diagonally opposite.
 On the fifth turn choose a diagonally opposite pair of glasses and reverse both. The bell will ring for sure.
****************************************************************

28) The Fox and The Duck Puzzle


Problem:
This is the classical puzzle asked in microsoft interview

A duck, pursued by a fox, escapes to the center of a perfectly circular pond. The fox cannot swim, and the duck
cannot take flight from the water. The fox is four times faster than the duck. Assuming the fox and duck pursue
optimum strategies, is it possible for the duck to reach the edge of the pond and fly away without being eaten?
If so, how?

Solution:
From the speed of the fox it is obvious that duck cannot simply swim to the opposite side of the fox to escape.

Fox can travel 4r in the time duck covers r distance. Since fox have to travel half of the circumference Pi*r
and Pi*r < 4r

So how could the duck make life most difficult for the fox? If the duck just tries to swim along a radius, the
fox could just sit along that radius and the duck would continue to be trapped.

At a distance of r/4 from the center of the pond, the circumference of the pond is exactly four times the
circumference of the duck’s path.

Let the duck rotate around the pond in a circle of radius r/4. Now fox and duck will take exact same time to
make a full circle. Now reduce the radius the duck is circling by a very small amount (Delta). Now the Fox
will lag behind, he cannot stay at a position as well.

Say, the duck circles the pond at a distance r/4 – e, where e is an infinitesimal amount. So as the duck
continues to swim along this radius, it would slowly gain some distance over the fox. Once the duck is able to
gain 180 degrees over the fox, the duck would have to cover a distance of 3r/4 + e to reach the edge of the
pond. In the meanwhile, the fox would have to cover half the circumference of the pond (i.e the 180 degrees).
At that point,

(pi * r ) > 4 * (3r/4 + e)

So time taken to travel 3r/4 is quicker than 3.14*r at four times the speed.(0.14*r distance is left)

The duck would be able to make it to land and fly away.

****************************************************************
29) 8 Balls Puzzle Find Defective One
(Trick: Always Divide into 3 equal or nearly equal parts)

Problem:
You have 8 balls. One of them is defective and weighs less than others. You have a balance to measure balls
against each other. In 2 weighing, how do you find the defective one?

Solution:
Defective ball is light

Make three Groups G1 – 3 balls G2 – 3 balls G3 – 2 balls

First weight- G1 and G2 if G1 = G2 then defective ball in G3 ,


weigh the the 2 balls in G3 if EQUAL then 3rd ball of G3 is defective
else whichever lighter in 1st or 2nd is defective ball

else if G1 < G2 defective ball in G1


weigh 1 and 2 ball of G1 if EQUAL then 3rd ball of G1 is defective
else whichever lighter in 1st or 2nd is defective ball

else if G1 > G2 defective in G2


Again in 1 comparison we can find the odd ball.

So by following above steps in 2 steps, lighter ball can be find out.

****************************************************************

30) Heavy and Light Balls Puzzle

Puzzle: You have 2 ball of each A,B,C colors and each color have 1 light and 1 heavy ball. All light balls are
of same weight same goes for heavy. Find out weight type of each ball in minimum chances. You can use a
two sided balance system (not the electronic one).
This puzzle was asked in many interviews – Drishti-soft, Yahoo, Infoedge.

Solution:
Simply, you can check by taking 2 balls of same color. Now, comparing those balls with other balls but this
will take 3 chances for each color type ball.

Answer is 2 chances.
So, Make a table for all conditions for all 6 balls that will help in understanding and solving this problem.

A1,A2,B1,B2,C1,C2

First weight A1,B1 and B2,C1 -> 3 cases equal ,left is heavy or left is light.

Case 1:
Equal, if equal weight simply B1,B2 will solve the problem.

Case 2:
If A1+B1 > B2+C1, then we know B1 > B2. Also just that A1>=C1.

Next compare A1,B1 and A2,C1


If A1+B1 = A2+C1 means A2 is heavy and A1=C1 light
If A1+B1 > A2+C1 means A2 is light and A1=C1 heavy
A1+B1 < A2+C1 will not happen because B1 is any way heavier.

Case 3:

If A1+B1 > B2+C1

Similar to above case we can check it.

****************************************************************

31) Prisoner and two Doors Puzzle


Problem:
Court takes decision to relax the sentence given to criminal if he can solve a puzzle. Criminal has to take
decision to open one of the doors.

Behind each door is either a lady or a tiger. They may be both tigers, both ladies or one of each.

If the criminal opens a door to find a lady he will marry her and if he opens a door to find a tiger he will be
eaten alive. Of course, the criminal would prefer to be married than eaten alive.

Each of the doors has a statement written on it.

The statement on door one says, “In this room there is a lady, and in the other room there is a tiger.”
The statement on door two says,“In one of these rooms there is a lady, and in one of these rooms there is a
tiger.”

The criminal is informed that one of the statements is true and one is false. Which door should the criminal
open?
Solution:
Criminal should open door number 2.

How?
Lets assume statement on the first door is true then second statement will also be true(as there will be a lady in
one door and a tiger in other door), but as we already know that only one statement can be true, so first
statement can not be true.

Now if first statement is false, it implies these possible scenarios

Door 1 Door 2
Tiger Tiger
Lady Lady
Tiger Lady

But as second statement is true, so it means behind one of the door there is a lady and in other door there is a
tiger so options with both lady and both tigers are ruled out and only third option remains valid, thus the
criminal should choose door number 2.

****************************************************************

32) Sand Timer Puzzle


This Puzzle is one of the most commonly asked interview puzzle.

Problem:
You have two sand timers with you. One can measure 7 minutes and the other sand timer can measure 11
minutes. This means that it takes 7 minutes for the sand timer to completely empty the sand from one portion
to the other.

You have to measure 15 minutes using both the timers. How will you measure it ?

Solution:

Mathematically

7 Minutes Sand Timer Finished.

Time Remaining in 11 minutes timer – 4 minutes

Reversing the 7 minutes timer – 4 minutes will elapse. 3 Minutes will left.
Once 11 minutes gets over reverse the 11 minutes timer again to use that 3 minutes. 8 Minutes left.

Now Reverse 7 minutes timer to measure 7+8 = 15 minutes.

****************************************************************

33) 3 Doors and Angel


Problem :
You are given a choice of three doors by an Angel. You can choose only one of the doors among the three. Out
of these three doors two contains nothing and one has a jackpot.

After you choose one of the doors angel reveals one of the other two doors behind which there is a nothing.
Angel gives you an opportunity to change the door or you can stick with your chosen door.

You don’t know behind which door we have nothing. Should you switch or it doesn’t matter?

Soltuion:
You choose one of the door. So probability of getting the jackpot – 1/3.

Let’s say that the jackpot is in Door no 1 and you choose Door no 1. So the angel will either open door no 2 or
door no 3. Let’s look at the sample space of this Puzzle.

Case -> Door1 Door2 Door3


Case 1 : Jackpot Nothing Nothing
Case 2 : Nothing Jackpot Nothing
Case 3 : Nothing Nothing Jackpot

Want to keep your guess:


Let’s suppose that you guessed correctly. Then it makes no difference what the game show host does, the other
door is always the wrong door. So in that case, by keeping your choice, the probability that you win is 1/3 x 1
= 1/3.
But let’s suppose you guessed incorrectly. In that case, the remaining door is guaranteed to be the correct door.
Thus, by keeping your choice, the probability of winning is 2/3 x 0 = 0.
Your total chances of winning by keeping your guess is: 1/3 + 0 = 1/3.

Want to change your guess:


Again, let’s suppose that you guessed correctly. By changing your guess the probability that you win is 1/3 x 0
= 0.
But let’s suppose you guessed incorrectly. Again, this means that the remaining door must be the correct one.
Therefore by changing your choice, the probability of winning is 2/3 x 1 = 2/3.
Your total chances of winning by changing your guess is: 2/3 + 0 = 2/3.

Hence it is advisable to switch.


****************************************************************

34) 10 identical bottles of pills


This is a very popular brain teaser with many companies.

Problem :
We have 10 identical bottles of identical pills (each bottle contain hundred of pills). Out of 10 bottles 9 have 1
gram of pills but 1 bottle has pills of weight of 1.1 gram. Given a measurement scale, how would you find the
heavy bottle? You can use the scale only once.

Answer:
First, arrange the bottles on shelf and now take, 1 pill from the first bottle, 2 pills from the second bottle, 3 pills
from the third bottle, and so on. Ideally you would have (10)*(11)/2=55 pills weighing 55 grams, when you
put the entire pile of pills on the weighing scale.The deviation from 55 g would tell you which bottle contains
the heavy pills.

If it is .1 gram more, it is 1st bottle which has heavy pill, if it is .2 more, gram 2nd bottle has heavy pills, if it is
.3 more, gram 3rd bottle has heavy pills.

****************************************************************

35) How Much Money He had Initially ?


Puzzle:
One person has some money in his pocket, He visits four temple on the way. As soon as he enters a temple, his
money gets double and he offers Rs. 100 in each temple thus his pocket gets empty after he returns from the
fourth temple. Now the question is how much money he had initially ?

Solution:

Let’s assume, person starts with Rs x


After 1st temple visit, he is left with Rs (2x-100)
After 2nd temple visit, he is left with Rs (4x-300)
After 3rd temple visit, he is left with Rs (8x-700)
After 4th temple visit, he is left with Rs (16x-1500), which is zero (as he is left with empty pockets)
Hence he started of with x i.e. Rs 1500/16 i.e. Rs 93.75
Answer: Rs 93.75

****************************************************************

36) When is Cheryl’s Birthday?


So when is Cheryl’s birthday? That’s a question confounding thousands of people around the world Monday as
a test question from Singapore goes viral.

Puzzle: Albert and Bernard just became friends with Cheryl, and they want to know when her birthday is.
Cheryl gives them a list of 10 possible dates.
May 15 May 16 May 19
June 17 June 18
July 14 July 16
August 14 August 15 August 17
Cheryl then tells Albert and Bernard separately the month and the day of her birthday respectively.

Albert: I don’t know when Cheryl’s birthday is, but I know that Bernard does not know too.
Bernard: At first I don’t know when Cheryl’s birthday is, but I know now.
Albert: Then I also know when Cheryl’s birthday is.

So when is Cheryl’s birthday?

Solution:
The solution involves using logic to deduce the dates which can’t possibly be Cheryl’s birthday.
The dates range from 14 to 19 among the 10 that are given with only 18 and 19 occurring once.
Albert, having seemingly been told the month rather than the day, first says he doesn’t know when her birthday
is – eliminating both 18 and 19 as possible days.
If Cheryl had told Albert that the month was May or June, then the day could have been May 19 or June 18,
and Bernard may have known the right day. But, as the question says, Albert knows Bernard does not,
meaning that Cheryl has said her birthday is in either July or August.

Out of the five remaining days in July and August, the day ranges from 14 to 17, with 14 appearing twice.

If Cheryl told Bernard her birthday was on the 14th, then he would not have known but, he does, meaning it
can’t be on the 14th.

That leaves only 3 possible days: July 16, August 15, and August 17.

After Bernard speaks, saying he knows the birthday given that information, it eliminates August from being a
contender since he still wouldn’t have known
whether it was August 15 or 17.

Therefore, Cheryl’s birthday is on July 16.

****************************************************************

37) Prove that p^2 – 1 is Divisible by 24


Problem:
Prove that p^2 – 1 is divisible by 24 if p is a prime number greater than 3?
Solution:
The most elementary proof , without explicitly mentioning any number theory: out of the three consecutive
numbers p–1, p, p+1, one of them must be divisible by 3; also, since the neighbors of p are consecutive even
numbers, one of them must be divisible by 2 and the other by 4, so their product is divisible by 3⋅2⋅4=24 —
and of course, we can throw p out since it’s prime, and those factors cannot come from it.
****************************************************************

38) King Octopus and Servants Puzzle


Puzzle: King Octopus has servants with six, seven, or eight legs. The servants with seven legs always lie, but
the servants with either six or eight legs always say the truth.
One day, 4 servants met :
The blue one says: “Altogether we have 28 legs”;
the green one says: “Altogether we have 27 legs”;
the yellow one says: “Altogether we have 26 legs”;
the red one says: “Altogether we have 25 legs”.

What is the colour of the servant that says the truth?

This is very famous logical puzzles.

Solution:
The green one is telling the truth.

Lets assume that one of them is telling the truth and then try to prove that. Since the four are disagreeing then 3
must be lying.

Lets say blue is telling the truth: so the blue one has either 6 or 8 legs. And each of the other octopus is lying
hence has 7 legs. So our total legs becomes: 6 + 7 + 7 + 7 = 27 legs or 8 + 7 + 7 + 7 = 29 legs. But since blue
said altogether we have 28 legs, we know he is lying.

If you follow this same logic for all of them, you realize that only the Green octopus can be telling the truth as
the number of legs adds up.

****************************************************************

39) 100 Wrong Statements puzzle


Puzzle: There are 100 statements.
1st one says : at least one is wrong.
2nd one says : at least two are wrong.
3rd one says : at least three are wrong.
4th one says : at least four are wrong.
and so on.
100th one says : at least 100 are wrong.
How many statements are actually wrong and how many actually right ?

Solution:
100th statement is definitely wrong because it says at least 100 are wrong.
But if that is correct, then 100 statement itself cannot be right.
=> 100th statement is wrong and
=> 1st statement is correct.
99th statement cannot be correct because if it were correct,
then two statements would become correct (1st and 99th itself.)
But 99th statement says that atleast 99 are wrong.
=> 99th is wrong and
=> 2nd is correct.
calculating so on…
50 statements are right (the first 50 ones)
remaining 50 statements are wrong.

****************************************************************

40) Supersonic bee and trains


Problem:
Two trains enter a tunnel 200 miles long, traveling at 100 mph at the same time from opposite directions. As
soon as they enter the tunnel a supersonic bee flying at 1000 mph starts from one train and heads toward the
other one. As soon as it reaches the other one it turns around and heads back toward the first, going back and
forth between the trains until the trains collide in a fiery explosion in the middle of the tunnel. How far did the
bee travel?
Solution:
This puzzle is a little tricky one. One’s thinking about solving this problem goes like this “ok, so i just need to
sum up the distances that the bee travels…” but then you quickly realize that its a difficult (not impossible)
summation.
The tunnel is 200 miles long. The trains meet in the middle traveling at 100 mph, so it takes them an hour to
reach the middle. The bee is traveling 1000 mph for an hour (since its flying the whole time the trains are
racing toward one another) – so basically the bee goes 1000 miles.

****************************************************************

41) Generate integer from 1-8 with equal probability


Problem:
Write a method to generate a random number between 1 and 8, given a method that generates a random
number between 1 and 3. The distribution between each of the numbers must be uniform.

Solution:
Let’s think of this like a decision tree. Each rand3() will be a decision.

If we somehow generate integers from 1 to a-multiple-of-8 (like 8, 16, 24, …) with equal probability, we can
use modulo division by 8 followed by adding 1 to get the numbers from 1 to 8 with equal probability.

We try to get maximum bunches of 8 as we can (1 – 16, 2 sets of 8). If we get any of the other values, we just
try again. Since the probability of getting each of 16 values are the same every time, trying again won’t affect
their probabilities.

We can generate from 1 to 16 with equal probability using the following expression.
6*rand3() + rand3() – 3
See, how this can be used?
1. For each value of first rand3(), there can be 6 possible combinations for values of second rand3(). So, there
are total 18 combinations possible.
2. The range of values returned by the above equation is 1 to 18, each integer occurring exactly once.
3. If the value of the equation comes out to be less than 17, return modulo division by 8 followed by adding 1.
Else, again call the method recursively. The probability of returning each integer thus becomes 1/8.

// returns 1 to 8 with equal probability


int my_rand()
{
int i;
while(1)
{
i = 6*rand3() + rand3() - 3;
if (i < 17)
return i%8 + 1;
}
}

****************************************************************

42) Flower Pot Puzzle


Puzzle:
Sara has 6 flower pots, each having a unique flower. Pots are arranged in an arbitrary sequence in a row. Sara
rearranges the sequence each day but not two pots should be arranged adjacent to each other which were
already adjacent to each other in previous arrangement. How many days she can do this or how many such
arrangements are possible ?
Solution:
we have (62)=15 different pairs of pots. At each days Sara realizes 5 of these pairs as ajacent. Since all these
pairs should be different, the number of days is at most 15/5=3 . The following example describes the
admissible list of arrangements for 3 days.
123456
246135
362514

****************************************************************

43) 3 Baskets And 4 Balls Puzzle


Puzzle: You have 3 baskets and each basket contains exactly 4 balls, each balls is of the same size. Each ball is
either red, black, yellow, or orange, and there is one of each color in each basket.
If you were blindfolded, and lightly shook each basket so that the balls would be randomly distributed, and
then took 1 ball from each basket, what chance is there that you would have exactly 2 red balls?

Solution:
There are 64 different possible outcomes, and in 9 of these, exactly 2 of the balls will be red. There is thus a
slightly better than 14% chance [(9/64)*100] that exactly 2 balls will be red.
A other way to solve the problem is to look at it this way.
There are 3 scenarios where exactly 3 balls are red:
123
———–
RRX
RXR
XRR

X is any ball that is not red.

There is a 4.6875% chance that each of these situations will occur.

Take the first one, for example: 25% chance the first ball is red, multiplied by a 25% chance the second ball is
red, multiplied by a 75% chance the third ball is not red. Because there are 3 scenarios where this outcome
occurs, you multiply the 4.6875% chance of any one occurring by 3, & you get 14.0625%

****************************************************************

44) Chasing Dog Puzzle


Puzzle: There are four dogs each at the corner of a unit square. Each of the dogs starts chasing the dog in the
clockwise direction. They all run at the same speed and continuously change their direction accordingly so that
they are always heading straight towards the other dog. How long does it take for the dogs to catch each other
and where?
Solution:
Each dog started at the corner and moving symmetrically. So each dogs start moving perpendicular to the
adjacent dogs. Lets assume v.
So each one start moving with speed v towards the next dog.

If we see realtive speed of the dog1 (v1), w.r.t dog 2, it changes perpendicularly. So it’ll not affect the time
taken along the direction of the dog1 to dog2 and the speed will be only v always.

So if they have started at corners with the distance of the length of the square (d).

Time = d/v. They’ll meet at the center.

****************************************************************

45) Cashier’s Puzzle


Problem: An engineer goes to a bank with a check of $200 and asks the cashier “Give me some one-dollar
bills, ten times as many twos and the balance in fives!”.
What will the cashier do?

Solution:
The smallest amount of one-dollar and two-dollar bills the cashier may give to the old man is 1×1 + 10×2 = 21.

He must give the old man a multiple of 21 i.e. 21 or 42 or 63 or 84 or 105 or 126 or 147 or 168 or 187 without
exceeding 200. Out of all these numbers only 105 can be added to a multiple of 5 to sum up to make 200
altogether.

So he must give the balance of 95 in five-dollar bills.

Therefore, the cashier must give 5 one-dollar bills, 50 two-dollar bills and 19 five-dollar bills.

****************************************************************

46) Probability of finding a job


Problem:
A candidate is selected for interview for 3 posts.The number of candidates for the first, second and third posts
are 3,4 and 2 respectively. What is the probability of getting at least one post?
Solution:
The probability the candidate does not get an offer from the first interview is 2/3. The probability she doesn’t
get an offer from the second is 3/4, and the probability she doesn’t get an offer from the third is 1/2.
So the probability she does not get an offer at all is 2/3⋅/34⋅1/2=1/4. Here we are assuming (unrealistically)
independence.

Thus the probability she gets at least one offer is 3/4.

We made the totally unreasonable assumption that job offers are given at random, that if there are 3 people
interviewed, exactly one, chosen at random, will get an offer. That’s not quite the way the world works!

****************************************************************

47) 25 horses and 5 lanes


Problem:
There are 25 horses and 5 lanes. You have no idea about which horse is better than other.
Find in minimum possible races, the first three fastest running horses.

Solution:

Draw out a table

In problems like this, it helps tremendously to create some sort of visual aid that you can refer to. With that in
mind, we have created this table where each entry represents a different horse.

X1 X2 X3 X4 X5
X6 X7 X8 X9 X10
X11 X12 X13 X14 X15
X16 X17 X18 X19 X20
X21 X22 X23 X24 X25

Let’s say that we have 5 races of 5 horses each, so each row in the table above represents a race. So, “X1 X2
X3 X4 X5 ” represents a race, and “X6 X7 X8 X9 X10 ” represents another race, etc. In each row, the fastest
horses are listed in descending order, from the fastest (extreme left) to the slowest (extreme right). The fastest
horses in each race are the ones on the left – so in the first race X1 was the fastest and X5 was the slowest. In
the second race X6 was the fastest, X7 was the second fastest and so on.

Only 5 horses each race


So, now we ask ourselves: what do we know after these 5 races? Well, we do have the 5 five fastest horses
from each race (X1, X6, X11, X16, and X21). But, does that mean we have the 5 fastest horses? Think
about that for a second. Well, actually it does not mean that we have the 5 fastest horses. Because, what if
the 5 fastest horses just happened to be in the first race – so X1 X2 X3 X4 X5 are the fastest horses. X1, X6,
X11, X16, and X21 are all the fastest horses in their individual groups, but there could be one group that just
happened to have all of the fastest horses. Remember we haven’t compared all the horses to each other since
we can only run 5 horses in a race, so that is still a possibility. This is very important to understand in this
problem.
Work through a process of elimination

Well, now that we’ve had 5 different races, we can eliminate the slowest 2 horses in each group since those
horses are definitely not in the top 3. This would leave these horses:

X1 X2 X3
X6 X7 X8
X11 X12 X13
X16 X17 X18
X21 X22 X23

We also know the 5 fastest horses from each group – but it’s important to remember that the 5 group leaders
are not necessarily the 5 fastest horses. So what can we do with that information?
Well, we can race those 5 horses against each other (X1, X6, X11, X16, and X21) and that would be the 6th
race. Let’s say that the 3 fastest in that group are X1, X6, and X11 – automatically we can eliminate X16 and
X21 since those 2 are definitely not in the top 3.

What other horses can we eliminate after this 6th race? Well, we can automatically eliminate all the horses that
X16 and X21 competed against in the preliminary races – since X16 and X21 are not in the top 3 then we also
know that any horse that’s slower than those 2 is definitely not in the top 3 either. This means we can eliminate
X17 X18 X22 and X23 along with X16 and X21.

Now, we also know that X1 is the fastest horse in the group since he was the fastest horse out of the 5 group
leaders. So, we don’t need to race X1 anymore. Are there any other horses that we can eliminate from further
races? Well, actually there are. Think about it – if X6 and X11 are the 2nd and 3rd fastest in the group leaders,
then we should be able to eliminate X8 since X6 raced against him and he was in 3rd place in that race. X7
could only possibly be the 3rd fastest, and since X8 is slower than X7, we can safely eliminate X8. We can
also eliminate X12 and X13 since X11 was the 3rd fastest in the group leaders, and X12 and X13 were slower
than X11.
So, all together we can eliminate these horses after the 6th race: X17 X18 X22 X23 X16 X21, X12, X13, X8
and X1. This leaves us with the following horses to determine the 2nd and 3rd fastest horses:

X2 X3
X6 X7
X11

What is the solution?

This means we only have 5 horses left! Now we race those horses one more time – in the seventh (7th) race –
and we can take out the top 2 horses and that would mean we have the 2nd and 3rd place horses! So, we have
found our answer! It takes 7 races to find the top 3 horses in this problem.

****************************************************************

48) 2 Eggs 100 Floors Puzzle


There is a building of 100 floors
-If an egg drops from the Nth floor or above it will break.
-If it’s dropped from any floor below, it will not break.
You’re given 2 eggs.
Find N
How many drops you need to make?
What strategy should you adopt to minimize the number egg drops it takes to find the solution?
Answer is 14:
In worst case it will take 14 egg drops to find the value of N.
This follows the below logic.
Say, the egg breaks at floor n we try to find out by going (N-1) till the first floor by doing linear search.
Say for example, I throw the egg from 10th floor, and it breaks, I wíll go to floor 1 to 9 to find out the floor..
Then I would try the same logic for every 10 floors thereby setting a worst case scenario of 19 chances.. I.e.
10,20,30,40,50,60,70,80,90,100,91,92,93,94,95,96,97,98,99
To find optimum solution, let’s try this:
If for every n, egg doesnt break, instead of going to next n, go to N-1, this would save us one drop as we are
doing a linear search with second egg when egg1 breaks…
So the series would look something like this..
N + (N-1) + (N-2) + (N-3) +…+ 1
Now this is a series which is equal to N(N+1)/2
Now since it is given that the egg may or may not break from 100th floor..
We can write it as..
N(N+1)/2>=100
And n=14(approx)
So we should start from 14 then move up N-1 to 13 floor I.e. 27,39…
So the floors from where the drop needs to be done are: 14,27,39,50,60,69,77,84,90,95,99,100
So the answer is 14

****************************************************************

49) 5 Pirates Fight for 100 Gold Coins Puzzle


5 pirates of different ages have a treasure of 100 gold coins.

On their ship, they decide to split the coins using this scheme:

The oldest pirate proposes how to share the coins, and ALL pirates (including the oldest) vote for or against it.

If 50% or more of the pirates vote for it, then the coins will be shared that way. Otherwise, the pirate proposing
the scheme will be thrown overboard, and the process is repeated with the pirates that remain.

As pirates tend to be a bloodthirsty bunch, if a pirate would get the same number of coins if he voted for or
against a proposal, he will vote against so that the pirate who proposed the plan will be thrown overboard.
Assuming that all 5 pirates are intelligent, rational, greedy, and do not wish to die, (and are rather good at math
for pirates) what will happen?

Answer :

To understand the answer,

we need to reduce this problem to only 2 pirates. So what happens if there are only 2 pirates. Pirate 2 can
easily propose that he gets all the 100 gold coins. Since he constitutes 50% of the pirates, the proposal has to
be accepted leaving Pirate 1 with nothing.

Now let’s look at 3 pirates situation, Pirate 3 knows that if his proposal does not get accepted, then pirate 2
will get all the gold and pirate 1 will get nothing. So he decides to bribe pirate 1 with one gold coin. Pirate 1
knows that one gold coin is better than nothing so he has to back pirate 3. Pirate 3 proposes {pirate 1, pirate 2,
pirate 3} {1, 0, 99}. Since pirate 1 and 3 will vote for it, it will be accepted.

If there are 4 pirates, pirate 4 needs to get one more pirate to vote for his proposal. Pirate 4 realizes that if he
dies, pirate 2 will get nothing (according to the proposal with 3 pirates) so he can easily bribe pirate 2 with one
gold coin to get his vote. So the distribution will be {0, 1, 0, 99}.

Smart right? Now can you figure out the distribution with 5 pirates? Let’s see. Pirate 5 needs 2 votes and he
knows that if he dies, pirate 1 and 3 will get nothing. He can easily bribe pirates 1 and 3 with one gold coin
each to get their vote. In the end, he proposes {1, 0, 1, 0, 98}. This proposal will get accepted and provide the
maximum amount of gold to pirate 5.
****************************************************************
50) 17 Horses Puzzle
Problem:
A farmer wants to divide his 17 horses among his three sons. According to farmer the oldest son should get
half of the horses,the middle son should get one third of the horses and the youngest son should get one ninth
of the horses.
When their father died they were not able to divide the horses as the result was coming in fractions. As the
sons were fighting on how to divide the horses a traveling mathematician came and heard their problem. He
proposed a solution with which all the sons got their share in the property without harming any animal.
What was the advice given and how the group of horses were divided?

Solution:
Well, this puzzle is interesting. you have to think such that with the solution everybody is happy and no body
will suffer a loss.
Let’s see the problem first.
we have 17 horses to be divided among three sons with the ratio as given.

1st son — half of the horses (17/2)=8.5


2nd son — one third of horses (17/3)=5.66
3rd son — one ninth of horses (17/9)=1.88

Now all the results are in fraction so the horses cannot be distributed like this. What will the traveling
mathematician do to solve it.

It’s simple. He will add his horse to the group of horses. So in total we have 18 horses now. Now let’s see the
scenario again.

1st son — half of the horses (18/2)=9


2nd son — one third of horses (18/3)=6
3rd son — one ninth of horses (18/9)=2

So in total 17 horses will get distributed among the three sons and the traveling mathematician will take his
horse and leave.

****************************************************************

51) Free the prisoners puzzle


The warden meets with 23 new prisoners when they arrive. He tells them, “You may meet today and plan a
strategy. But after today, you will be in isolated cells and will have no communication with one another.
“In the prison is a switch room, which contains two light switches labeled 1 and 2, each of which can be in
either up or the down position. I am not telling you their present positions. The switches are not connected to
anything.
“After today, from time to time whenever I feel so inclined, I will select one prisoner at random and escort him
to the switch room. This prisoner will select one of the two switches and reverse its position. He must flip one
switch when he visits the switch room, and may only flip one of the switches. Then he’ll be led back to his
cell.
“No one else will be allowed to alter the switches until I lead the next prisoner into the switch room. I’m going
to choose prisoners at random. I may choose the same guy three times in a row, or I may jump around and
come back. I will not touch the switches, if I wanted you dead you would already be dead.
“Given enough time, everyone will eventually visit the switch room the same number of times as everyone
else. At any time, anyone may declare to me, ‘We have all visited the switch room.’
“If it is true, then you will all be set free. If it is false, and somebody has not yet visited the switch room, you
will all die horribly. You will be carefully monitored, and any attempt to break any of these rules will result in
instant death to all of you”
What is the strategy they come up with so that they can be free?
Solution:
The switch #1 is used to COUNT. The #2 is used to PASS.

The prisoners elect a leader and stablish the following rules and behaviours:
– Only the leader can turn the switch #1 off.
– Only the leader can announce that they all visited the room.
– Leader’s behavior:
If the switch #1 is on, turn off the switch #1 and count 1 visit more ( # of visits starts from zero).
If the # of visits is equal to 23 (22 prisoners plus the case were the switch #1 was already on),warns: “We have
all visited the switch room”
If not, flips the switch #2.
– Other’s behavior:
If the switch #1 is turned off and I never turned the switch #1 on, then turn the switch #1 on.
If not, flips the switch #2.
****************************************************************

52) Find the survivor


100 people standing in a circle in an order 1 to 100. No.1 has a sword. He kills next person (i.e. no. 2) and
gives sword to next to next (i.e no.3). All person does the same until only 1 survives. Which number survives
at the last?
Solution:
Consider the case when there are 2^n numbers in the circle. Each time the number reduces by half and the
number 1 remains till the end.
In the given question, 1 kills 2, 3 kills 4 and so on till 71 kills 72. 36 people have been killed till now. 64
people remain in the circle. 64 is a power of 2. So the first guy after 72 will be the new number 1 in a circle of
2^6. So 73 will survive.
****************************************************************

53) The Man in the Elevator


A man lives on the tenth floor of a building. Every day he takes the elevator to go down to the ground floor to
go to work or to go shopping. When he returns he takes the elevator to the seventh floor and walks up the stairs
to reach his apartment on the tenth floor. On a rainy day, or if there are other people in the elevator, he goes to
his floor directly. He hates walking so why does he do it?
This is probably the best known and most celebrated of all lateral thinking puzzles. It is a true classic.
Although there are many possible solutions which fit the initial conditions, only the canonical answer is truly
satisfying.
Solution:
Canonical answer to this problem would be that the man is a Dwarf. We can conclude this because on rainy
day he had Umbrella and when other people are in elevator then they will help him. Other days he has none.
****************************************************************

54) The Puzzle of 100 Hats


100 persons are standing in line, each facing the same way. Each person is wearing a hat, either red or blue,
but the hat color is not known to the person wearing the hat. In fact, a person knows the hat color only of those
persons standing ahead of him in line.
Starting from the back of the line (that is, with the person who can see the hat colors of all of other 99 persons),
in order, and ending with the person at the head of the line (that is, with the person who can see the hat color of
no one), each person exclaims either “red” or “blue”. These exclamations can be heard by all. Once everyone
has spoken, a score is calculated, equal to the number of persons whose exclamation accurately describes their
own hat color.
What strategy should the 100 persons use in order to get as high a score as possible, regardless of how the hat
colors are assigned? (That is, what strategy achieves the best worst-case score?)
For example, if everyone exclaims “red”, the worst-case score is 0. If the first 99 persons exclaim the color of
the hat of the person at the head of the line and the person at the head of the line then exclaims the color he has
heard, the worst-case score is 1. If every other person exclaims the hat color of the person immediate in front
and that person then repeats the color he has just heard, then the worst-case score is 50. Can you do better?
Hint: Instead of using just red and blue as the possible hat colors and exclamations, use N different colors.
Solution:
The person standing at the back of the line can see all the people. I think it is important to consider that this
problem has specifically 100 people in it, instead of some variable amount. This means the person in the back
can see 99 people in blue and red hats in front of him. Since there are an odd number of hats the last person can
see, it means that:
1. The number of red and blue hats the last person can see is not equal.
2. Either the red or the blue hats contain an odd number of hats, but not both.
With this in mind, we will be able to consistently communicate hat colors to all the participants. The person in
the back of the line will begin by counting all the hats, and saying whatever color has an odd number of
hats. The second person will then be able to count the hats in front of him (meaning all hats the last person
saw minus the one he is wearing) if he sees an even number of the same color the first person said, he
must be wearing that colored hat, otherwise he is wearing the other colored hat.
For example, if the person in the back sees an odd number of red hats, he will declare “red”. The second to last
person will then count the amount of red hats he sees, if he sees an odd number, it means he is wearing a blue
hat, if he sees an even number, it means he is wearing a red hat.
This process will work if every person in line keeps track of which colors have an odd or even count. Thus the
worst case for this solution is 99, since the person at the front will answer solely based on what is in front of
him, he will have a 50% chance of guessing correctly.
****************************************************************

55) Random Airplane Seats


People are waiting in line to board a 100-seat airplane. Steve is the first person in the line. He gets on the plane
but suddenly can’t remember what his seat number is, so he picks a seat at random. After that, each person
who gets on the plane sits in their assigned seat if it’s available, otherwise they will choose an open seat at
random to sit in.
The flight is full and you are last in line. What is the probability that you get to sit in your assigned seat?
Solution:
I offer my explanation, since none of the answers below seems to explain the solution.
The probabilty is indeed 1/2. There are two things to realize:
1. The probabilty that Steve chooses his assigned seat is equal to the probability that he chooses your assigned
seat.
2. In case that Steve would choose neither his own seat nor yours, then there are two alternatives: if somebody
else would choose Steve’s seat at random, then you would get your assigned seat; otherwise you would be left
with the Steve’s seat.
With that being said, we can go on to find out the probability. With every person choosing a seat at random
(including Steve), there are there possible outcomes:
1. either he chooses your assigned seat, or
2. chooses the Steve’s seat, or
3. chooses someone else’s seat.
Notice, that the probabilty of choosing Steve’s seat is always equal to probabilty of taking your seat. That
means that the probabilty of you getting your seat vs. not, is even. The case of a passanger choosing someone
else’s seat doesn’t affect your final outcome in either way, it just passes that three possible alternatives to the
next passenger.
Since the probability of someone taking your place is always equal to the probabilty of someone taking Steve’s
place (and this also applies to the penultimate passenger with only two seats left), the probabilty of you getting
your assigned seat is in the end 50%.
****************************************************************

56) Connect 3 houses with 3 wells


Connect every house with every well without the lines intersecting.

Solution:

OR,
****************************************************************

57) Measure 9 minutes from 2 hourglasses puzzle


Using only a Four-minute hourglass and a seven-minute hourglass,
How will you measure exactly nine minutes?
Restriction:- Without the process taking longer than nine minutes.
Solution:

We measure 7 Minute from One Hourglass. We reverse it at 7th minute


And, 4+4=8 Minutes from Second Hourglass – 8 Minutes
8(from 1)-7(From 2) = 1 Minute – 1 Minutes
TOTAL = 9 MINUTES
EXPLANATION-
0 Minutes – Start both hourglass at the same time.
4 Minutes – The four minute glass runs out. Flip the four minute glass.
7 Minutes – The seven minute glass runs out. Flip the seven minute glass.
8 Minutes – The four minute glass runs out; the seven minute glass has been running for one minute. Flip the
seven minute glass.
9 Minutes – The seven minute glass runs out.
****************************************************************

58) Defective stack of coins puzzle


There are 10 stacks of 10 coins each.
Each coin weights 10 gms. However, one stack of coins is defective and each coin in that stack weights only 9
gms.
What is the minimum number of weights you need to take to find which stack is defective? How?
SOLUTION- 1 Measurement Only
EXPLANATION-
We will take,
1 coin from the first stack,
2 coins from the second,
3 from the third
and
so on.
In total we will have 55 coins.
If all of them were non-defective, they would weigh 550 gms.
If stack 1 is defective, the measure would read 549 gms.
If stack 2 is defective, you will read 548 gms.
and so on.
So by taking one measurement you can identify, which is the defective stack.
****************************************************************

59) Box with Defective Balls


Here is a situation. You have 10 boxes that contains balls with each of the ball weighing 10 grams precisely.
Now among the boxes, one of the box comprises of defective balls with each defective ball weighing 9 grams.
You have been provided with an electronic weighing machine but you are allowed to use it only once.

Can you find out which box contains defective balls?


Solution:
The question can practically disarm you. But we promise by the time you read the solution, you will find that it
was way easy than you were thinking.

Let us name the boxes with a number - Box1, Box 2..., Box10. Now you must be familiar with the weights of
the balls precisely. By saying that we are not implying that you will have to take one ball from every box and
judge the weight of every ball.

What you have to do is pick one ball from Box 1, 2 balls from Box 2, 3 balls from Box 3, ...., 10 balls from
Box 10. Thus after taking balls from every box in such a manner, you will finally have 55 balls in total. There
comes the time to use the weighing machine.

If all the balls were weighing adequate, the combined weight should be 55 x 10 grams = 550 grams. But since
one of the box has defected balls, the weight will be less than that. Here is the tricky part and explains why we
took different number of balls from each box.

If the total weight is less than 1 gram, then the defective box is the Box 1 since we took 1 ball from that box. If
the Box 2 is defective, the total weight will be less than 2 grams. In similar fashion you can identify the
defective box by analyzing the total weight that is calculated by the weighing machine.
****************************************************************

60) Tower of Hanoi Solution


The binary numbers, considered in numerical order, comprise a set of sequential moves that
will allow you to solve the game of the Tower of Hanoi with the minimum number of moves,
specifically

2n - 1

where n is the number of disks. Each binary number is read from the right until the first "1" is
encountered. The position of that "1" from the right indicates the disk to move. If there is no
other "1" in the binary number, that disk is moved to an empty peg. The second "1" from the
right indicates the location of the reference disk. If there are no or an even number of zeros
between these two "1"s (the first two "1"s from the right), the moving disk is moved so as to
cover the reference disk. If there is an odd number of zeros between these two "1"s, the
moving disk is moved so as NOT to cover the reference disk.

A few examples for five disks follow:

Move Binary Number Interpretation

8 01000 Move disk 4 to empty peg.

13 01011 Move disk 1 to cover disk 2.

25 11001 Move disk 1 to cover disk 4.

18 10010 Move disk 2 to cover disk 5.

10 11010 Move disk 2 NOT to cover disk 4.

17 10001 Move disk 1 NOT to cover disk 5.

The table below lists the 25- 1 = 31 sequential moves required for a tower with five
disks. Try it with the interactive tower in Towers of Hanoi Puzzle. Before you begin,
reset the number of blocks (disks) to five (5).

Move Binary Number Interpretation

1 00001 Move disk 1 to empty peg.

2 00010 Move disk 2 to empty peg.

3 00011 Move disk 1 to cover disk 2.

4 00100 Move disk 3 to empty peg.

5 00101 Move disk 1 NOT to cover disk 3.

6 00110 Move disk 2 to cover disk 3.


7 00111 Move disk 1 to cover disk 2.

8 01000 Move disk 4 to empty peg.

9 01001 Move disk 1 to cover disk 4.

10 01010 Move disk 2 NOT to cover disk 4.

11 01011 Move disk 1 to cover disk 2.

12 01100 Move disk 3 to cover disk 4.

13 01101 Move disk 1 NOT to cover disk 3.

14 01110 Move disk 2 to cover disk 3.

15 01111 Move disk 1 to cover disk 2.

16 10000 Move disk 5 to empty peg.

17 10001 Move disk 1 NOT to cover disk 5.

18 10010 Move disk 2 to cover disk 5.

19 10011 Move disk 1 to cover disk 2.

20 10100 Move disk 3 NOT to cover disk 5.

21 10101 Move disk 1 NOT to cover disk 3.

22 10110 Move disk 2 to cover disk 3.

23 10111 Move disk 1 to cover disk 2.

24 11000 Move disk 4 to cover disk 5.

25 11001 Move disk 1 to cover disk 4.

26 11010 Move disk 2 NOT to cover disk 4.

27 11011 Move disk 1 to cover disk 2.

28 11100 Move disk 3 to cover disk 4.

29 11101 Move disk 1 NOT to cover disk 3.

30 11110 Move disk 2 to cover disk 3.


31 11111 Move disk 1 to cover disk 2.

**************************************************************

61) (Maximum run in cricket)


Question: In a one day international cricket match, considering no wide balls, no wides, no extras and no
overthrows.
What is the maximum number of runs that a batsman can score in an ideal case ?
Note:”Here we assume ideal and little practical scenario. We assume that batsman can not run for more than 3 runs
in a ball, as otherwise there is no limit, he can run infinite runs(theoretically) in a ball, as far as opposite team does
not catch the ball.”

Answer:

49*(6*5+3)+(6*6)= 1653
From Over 1 to 49:
1st ball:- 6 runs(hit six)
2nd ball:- 6 runs(hit six)
3rd ball:- 6 runs(hit six)
4th ball:- 6 runs(hit six)
5th ball:- 6 runs(hit six)
6th ball:- 3 runs(took 3 runs between the wickets and take back the strike)
= >49*(6*5+3)
50th Over:
Hit six sixes in a row.
= >6*6

****************************************************************

62) Matchstick Puzzle


Question: How to make 4 equilateral triangles with 6 match sticks?

We strongly recommend you to minimize your browser and try this yourself first

Answer: Make a tetrahedron.


****************************************************************

63) Prisoner and Policeman Puzzle


Policeman decided to punish the Prisoner and asked him to make a statement. The Prisoner should make such a
statement so that he would be alive.
If the statement is held true by Policeman, the Prisoner will be hanged to death and if the statement is held false, the
Prisoner will be shot dead.

Answer:
The Prisoner said, ‘I will be shot dead’
If Policeman says the statement is true, the Prisoner will be hanged to death which will make his statement false.
If Policeman says the statement is false, the Prisoner will be shot dead which will make the statement true.

****************************************************************

64) Last Palindrome Date Before 10/02/2001


In year 2001 on October 2, 2001, the date in MMDDYYYY format was a palindrome (same forwards as backwards),
10/02/2001 -> “10022001”
When was the last palindrome date before 10/02/2001?

Answer:
One year can have only one palindrome as the year fixes the month and date too, so the year has to be less than
2001 since we already have the palindrome for 10/02. It can’t be any year in 1900 because that would result in a day
of 91, same for 1800 down to 1400. it could be a year in 1300 because that would be the 31st day.

So what’s the latest year in 1300 that would make a month?


When you first look at it, 12th month comes to mind as we have to find the latest date, so it seems it would be 1321.
But we have to keep in mind that we want the maximum year in 1300 century with a valid date, so lets think about
1390 that will give the date as 09/31, is this a valid date…? No, because September has only 30 days, so last will be
the 31st August. Which means the correct date would be 08/31/1380.

65) Car Wheel Puzzle


A car has 4 tyres and 1 spare tyre. Each tyre can travel a maximum distance of 20000 miles before wearing off. What
is the maximum distance the car can travel before you are forced to buy a new tyre? You are allowed to change tyres
(using the spare tyre) unlimited number of times.

Answer: 25000
Divide the lifetime of spare tire into 4 equal part i.e., 5000 and swap it at each completion of 5000 miles distance.
Let four tyres be A, B, C and D and spare tyre be S.
5000 KMs: Replace A with S.
10000 KMs: Put A back to its original position and replace B with S
15000 KMs: Put B back to its original position and replace C with S
20000 KMs: Put C back to its original position and replace D with S
All tyres are used upto their full strength.

****************************************************************
66) Newspaper Puzzle
Question: A newspaper made of 16 large sheets of paper folded in half. The newspaper has 64 pages altogether.
The first sheet contains pages 1, 2, 63, 64.

If we pick up a sheet containing page number 45. What are the other pages that this sheet contains?

Answer:
On the back of 45, it is 46.

If we look at page numbers on sheet 1, we observe that


1+63=64
2+64=66

Then,
64-45=19
66-46 = 20
So the four pages in this sheet are 19, 20, 45, 46.

OR, we can also make pairs like


1+64=65
2+63=65
Therefore, 65-45=20
65-46=19

So the four pages in this sheet are 19, 20, 45, 46.

****************************************************************

67) Chessboard and dominos


There is an 8 by 8 chessboard in which two diagonally opposite corners have been cut off.You are given 31 dominos,
and a single domino can cover exactly two squares. Can you use the 31 dominos to cover the entire board?

Answer:
No
Explanation:
At first it seems that there were 8*8 = 64 squares
then 2 have been cut off so Squares remaining= 64-2 = 62
And there are 31 dominos, so they will cover the remaining chessboard coz = 31*2 = 62
But this is not the answer:
Lets visualize it:
Each domino we set on the chessboard will always take 1 Black and 1 White square.Therefore, 31 dominos will
take 31 white square and 31 black squares exactly. On this chessbord however, we must have 32 black and 30
white squares. Hence it is not possible to do so.
****************************************************************

68) Days of month using 2 dice


How can you represent days of month using two 6 sided dice? You can write one number on each face of the dice
from 0 to 9 and you have to represent days from 1 to 31, for example for 1, one dice should show 0 and another
should show 1, similarly for 29 one dice should show 2 and another should show 9.
Answer:
Dice 1: 0 1 2 3 5 7
Dice 2: 0 1 2 4 6 8
Explanation:
You have to show 11, 22 so 1 and 2 should be present in both dices, similarly to show 01, 09. 0 should be present in
both dices, now the trick is for showing 9 you can use dice with 6 printed on one of the face.

****************************************************************

69) Strategy for a 2 Player Coin Game


Consider a two player coin game where each player gets turn one by one. There is a row of even number of coins,
and a player on his/her turn can pick a coin from any of the two corners of the row. The player that collects coins with
more value wins the game. Develop a strategy for the player making the first turn, such he/she never looses the
game.
Note that the strategy to pick maximum of two corners may not work. In the following example, first player looses the
game when he/she uses strategy to pick maximum of two corners.
Example
18 20 15 30 10 14

First Player picks 18, now row of coins is

20 15 30 10 14
Second player picks 20, now row of coins is

15 30 10 14

First Player picks 15, now row of coins is

30 10 14

Second player picks 30, now row of coins is


10 14

First Player picks 14, now row of coins is

10

Second player picks 10, game over.

The total value collected by second player is more (20 +

30 + 10) compared to first player (18 + 15 + 14).


So the second player wins.

Solution:
The idea is to count sum of values of all even coins and odd coins, compare the two values. The player that makes
the first move can always make sure that the other player is never able to choose an even coin if sum of even coins is
higher. Similarly, he/she can make sure that the other player is never able to choose an odd coin if sum of odd coins
is higher.
Example
18 20 15 30 10 14
Sum of odd coins = 18 + 15 + 10 = 43
Sum of even coins = 20 + 30 + 14 = 64.
Since the sum of even coins is more, the first
player decides to collect all even coins. He first
picks 14, now the other player can only pick a coin
(10 or 18). Whichever is picked the other player,
the first player again gets an opportunity to pick
an even coin and block all even coins.
****************************************************************

70) 1000 Coins and 10 Bags


A dealer has 1000 coins and 10 bags. He has to divide the coins over the ten bags, so that he can make any number
of coins simply by handing over a few bags. How must divide his money into the ten bags?

Solution:
We can represent any decimal number as weights of binary system. For example, if we want to measure upto 7, first
three bags are sufficient.
1 = 2^0
2 = 2^1
3 = 2^0 + 2^1
4 = 2^2
5 = 2^2 + 2^0
6 = 2^2 + 2^1
7 = 2^2 + 2^1 + 2^0
It can be easily generalized. We can measure upto 2^n – 1.
Fun is, we can also measure the same using powers of 3. For example, we have bags with 1, 3 and 9 coins,
1=1
2 = 3-1
3=3
4 = 3+1
5 = 9-3-1
6 = 9-3
7 = 9+1-3
8 = 9 -1
9=9
10 = 9+1
11 = 9+3-1
12 = 9+3
13 = 9+3+1
From 14 onwards next bag comes into picture.
Factorization algorithms other than powers of 2 are costly on computer systems. Please share any other information.
Any person working on cryptography can share more details.

****************************************************************

71) Tic Tac Toe Puzzle


Statement:
The game of Tic-Tac-Toe is being played between two players and it is in below state after six moves.

Can you answer following questions?


1. Who will win the game, O or X?
2. Which was the sixth mark and at which position?
Assume that both the players are intelligent enough.

Solution:
O will win the game. The sixth mark was X in square 9.

Explanation:
The 7th mark must be placed in square 5 which is the win situation for both X and O. Hence, the 6th mark must be
placed in a line already containing two of the opponents marks. There are two such possibilities – the 6th mark would
have been either O in square 7 or X in square 9.
As we know both the players are intelligent enough, the 6th mark could not be O in square 7. Instead, he would have
placed O in square 5 and would have won.
Hence, the sixth mark must be X placed in square 9. And the seventh mark will be O. Thus O will win the game.

You might also like