# Puzzle – Set 1

1. Logic Puzzle
4. Puzzles and Trick Questions
5. PuzzleFry
6. ***BigRiddle
7. ***CrazyForCode
10. ***http://www.mytechinterviews.com/category/puzzles/page/4
11. http://www.techinterview.org/page/3/
12. https://gauravsachin007.wordpress.com/page/5/
13.*** Geeksforgeeks.org
14. http://interviewpuzzles1568.blogspot.in/,
http://cseanitw.blogspot.in/2012/03/algol-question-paper-1write-method-to.html
http://commoninterview.com/tag/coin,+puzzle,+box,all
2. I borrowed \$50 from mum and \$50 from dad to buy a bag costing \$97. After the purchase, I had \$3 left. I returned \$1 to dad and \$1 to mum, and reserved \$1 for myself. I now owe \$49+\$49=\$98 plus the \$1 I reserved for myself, which is \$99. Where is the missing \$1?
3. You are a prisoner in a room with 2 doors and 2 guards. One of the doors will guide you to freedom and behind the other is a hangman –you don’t know which is which. One of the guards always tells the truth and the other always lies. You don’t know which one is the truth-teller or the liar either. You have to choose and open one of these doors, but you can only ask a single question to one of the guards.
What do you ask so you can pick the door to freedom?
4. Out of a thousand identical buckets filled with water, one contains poison. The poison will kill a pig in exactly 30 minutes. If you must locate the poisoned bucket within one hour, what is the minimum number of pigs needed?
First Approach – If the pig dies in exactly 30mn, then you can make it drink from every  bucket each 1 second apart, which will take 16mn( 1000 sec for 100 bucket and 1000sec ~16 mins), then you wait and  measure its time of death precisely, and the poisonous bucket is the one that you made it drink from 30mn before that. If you can’t get that much precision, (say it’s not 30mn to the second), you might need more pigs, since waiting even 2 seconds between each bucket won’t always give you the solution in 1 hour. If you end up needing too many pigs, you can use another user’s solution.

** Second approach.  – Similar Problem on GeeksforGeeks –
Use binary notational to identify each bottle uniquely.
5. A blind man is alone on a deserted island. He has two blue pills and two red pills. He must take exactly one red pill and one blue pill or he will die. How does he do it?
6. What are the next numbers in this series: 2.5, 4, 7, 10, 16, 19?
7. You have a microwave whose timer is damaged and you don’t have any other watch except two hourglasses, Hourglass A Measures an exact 7 minutes and Hourglass B Measures an exact 4 minutes. Using these two hour glasses, you need to make pizza for exact 9 minutes in microwave. How will you? 1. Set both the hourglasses running from initial position. (0 min.)
2. 4th Minute: When the 4-min hourglass runs out, reset it (reverse). At this point, the 7-min hourglass will have 3 min. left.
3. 7th Minute: After the 7-min.hourglass runs out, reset that one also. At this point, the 4-min hourglass will have 1 min. left.
4. 8th Minute: By the time the 4-min hourglass runs out (total 8 min. lapsed), the 7-min. hourglass will have drained 1 min. (after reset)
5. Now, reset the 7-min hourglass again. Since it had run 1 minute after previous reset, it will run for one minute, taking the total time to 9 min.
8. What is the minimum number of races necessary to determine your three fastest horses? – Adobe
9. You have three jars filled with candies. One jar is filled with banana candies, one jar is filled with lemon candies and one jar has a mix of both. All the jars are mislabelled (i.e. all the jars have wrong labels about what kind of candies they contain).
All the candies look very similar in shape, size and color and they even smell the same. The only way to distinguish them is by tasting. You have to eat one and only one candy to determine the correct jar labels. You can eat that one candy from any jar you want as long as you eat only one in total. – Microsoft, Adobe
1( label – lemon)   2(mixed)   3(banana) – Pick from the mixed jar. Since it’s labelled mix it can’t be true. Suppose it is lemon. So now we know jar 2 is lemon. Since 3 is labelled as banana it given that’s it false. So 3 will be mixed and 1 will be banana( banana label is wrong and it can’t be on jar 2 so it has to be on jar 1).
10. You have two ropes. Each takes exactly 60 minutes to burn. They are made of different material so even though they take the same amount of time to burn, they burn at separate rates. In addition, each rope burns inconsistently. How do you measure out exactly 45 minutes?  – Adobe
11. The probability of a car passing a certain intersection in a 20 minute windows is 0.9. What is the probability of a car passing the intersection in a 5 minute window? (Assuming a constant probability throughout) (15-01-2016)
12. You have 100 coins laying flat on a table, each with a head side and a tail side. 10 of them are heads up, 90 are tails up. You can’t feel, see or in any other way find out which side is up. Split the coins into two piles such that there are the same number of heads facing up in each pile. How did you do it? (16-01-2016)
Split the coins into two parts of size: 10 and 90. Take the 10 coins pile and flip ALL of them. You should have the same number of heads in both the sections. Reasoning: When you split it up as above let x heads be in the 10 pile and we have 10 – x heads in the 90 pile. When we flip the 10 pile, we should have 10-x heads, the same as the 90 pile.
13. 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)  (17-01-2016)
14. 100 prisoners are stuck in the prison in solitary cells. The warden of the prison got bored one day and offered them a challenge. He will put one prisoner per day, selected at random (a prisoner can be selected more than once), into a special room with a light bulb and a switch which controls the bulb. No other prisoners can see or control the light bulb. The prisoner in the special room can either turn on the bulb, turn off the bulb or do nothing. On any day, the prisoners can stop this process and say “Every prisoner has been in the special room at least once”. If that happens to be true, all the prisoners will be set free. If it is false, then all the prisoners will be executed. The prisoners are given some time to discuss and figure out a solution. How do they ensure they all go free? (18-01-2016)
15. Given a fleet of 50 trucks, each with a full fuel tank and a range of 100 miles, how far can you deliver a payload? You can transfer the payload from truck to truck, and you can transfer fuel from truck to truck. Assume all the payload will fit in one truck. (19-01-2016)
16. 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? PENDING (20-01-2016)
17. How many points are there on the globe where, by walking one mile south, then one mile east and then one mile north, you would reach the place where you started? Youtube (21-01-2016)
18. A train leaves City X for City Y at 15 mph. At the very same time, a train leaves City Y for City X at 20 mph on the same track. At the same moment, a bird leaves the City X train station and flies towards the City Y train station at 25 mph. When the bird reaches the train from City Y, it immediately reverses direction. It then continues to fly at the same speed towards the train from City X, when it reverses its direction again, and so forth. The bird continues to do this until the trains collide. How far would the bird have traveled in the meantime?   (22-01-2016)
same Question
Relative Speed Concept
19. Three ants are sitting at the three corners of an equilateral triangle. Each ant randomly picks a direction and starts to move along the edge of the triangle. What is the probability that none of the ants collide?  (23-01-2016)
20. A duck that is being chased by a fox saves itself by sitting at the center of circular pond of radius r. The duck can fly from land but cannot fly from the water. Furthermore, the fox cannot swim. The fox is four times faster than the duck. Assuming that the duck and fox are perfectly smart, is it possible for the duck to ever reach the edge of the pond and fly away to its escape from the ground? (24-01-2016)
21. You have 50 red marbles, 50 blue marbles and 2 jars. One of the jars is chosen at random and then one marble will be chosen from that jar at random. How would you maximize the chance of drawing a red marble? What is the probability of doing so? All 100 marbles should be placed in the jars.(25-01-2016)
22. You are given b boxes and n dollar bills. The money has to be sealed in the b boxes in a way such that without thereafter opening a box, you can give someone a requested whole amount of dollars from 0 to n. How should b be related to n for this to happen?  – PENDING (26-01-2016)
23. 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. (27-01-2016)
24. If you had an infinite supply of water and a 5 quart and 3 quart pails, how would you measure exactly 4 quarts? and What is the least number of steps you need?(28-01-2016)
25. You’ve got someone working for you for seven days and a gold bar to pay them. You must pay the worker for their work at the end of every day. If you are only allowed to make two breaks in the gold bar, how do you pay your worker? (Assuming equal amount of work is done during each day thus requiring equal amount of pay for each day) (29-01-2016)
26. Five pirates discover a chest containing 100 gold coins. They decide to sit down and devise a distribution strategy. The pirates are ranked based on their experience (Pirate 1 to Pirate 5, where Pirate 5 is the most experienced). The most experienced pirate gets to propose a plan and then all the pirates vote on it. If at least half of the pirates agree on the plan, the gold is split according to the proposal. If not, the most experienced pirate is thrown off the ship and this process continues with the remaining pirates until a proposal is accepted. The first priority of the pirates is to stay alive and second to maximize the gold they get. Pirate 5 devises a plan which he knows will be accepted for sure and will maximize his gold. What is his plan? (30-01-2016)
27. A man needs to go through a train tunnel to reach the other side. He starts running through the tunnel in an effort to reach his destination as soon as possible. When he is 1/4th of the way through the tunnel, he hears the train whistle behind him. Assuming the tunnel is not big enough for him and the train, he has to get out of the tunnel in order to survive. We know that the following conditions are true.
1. If he runs back, he will make it out of the tunnel by a whisker.
2. If he continues running forward, he will still make it out through the other end by a whisker.
What is the speed of the train compared to that of the man? (31-01-2016)
28. Green Eyes Problem OR Cheating husband problem. – http://www.ritambhara.in/cheating-husband-puzzle/
29. Blue Eyed Islanders puzzle
if there was one person with blue eye. In that case he could see  everyone else’s eye colour and know that he’s the odd one there and do the needful.
If there are two people with blue eyes –
consider person 1(P1) – he does not knows his eye colour. But he can see one person(P2) with blue eye. So he thinks that P2 will commit suicide.
consider person 2(P2) – he does not knows his eye colour. But he can see one person(P1) with blue eye. So he thinks that P1 will commit suicide.
When both see that none of them have done anything then each one will have a doubt whether he’s the one with blue eye.
So P1 thinks if there was only one blue eye person(i.e P2) then P2 would have committed suicide as person the above case 1. But since P2 didn’t do anything it means P2 can see someone else with blue eye which obviously is him( as P1 can see no one else has blue eye). Same thought process for P2. So now both know that there are two people with blue eye. Since each can see that only one person with blue eye it means the other person is themselves.So each commit suicide.
30.  There are N doors in a row, numbered from 1 to N. Initially all are closed.
Then you make N passes by N doors. In first pass you toggle (open the door if it is closed and close it if it is opened) all the doors starting from the first door. In the second pass you toggle every door whose number is a multiple of 2 (2, 4, 6, 8, 10…). In 3rd pass you toggle doors whose number is multiple of 3 (3, 6, 9, ..) and so on.. In the i‘th pass you toggle all the doors which are multiple of i.
What will be the state of k‘th door after all the passes?