Showing posts with label Puzzles. Show all posts
Showing posts with label Puzzles. Show all posts

Fake currency!!

Problem: A woman goes to buy a pair of shoes. She stops at a shoe store and buys a pair of shoe worth 200 rupees. She hands a thousand rupee note to the shopkeeper. Shopkeeper is short of change, he goes to a nearby tea stall and brings the change. He keeps 200 rupees with himself, handing 800 rupees to the woman. After woman leaves, tea stall owner comes to the shoe store and claims the note to be a fake one. Shoe store owner checks it and agrees. Now the question is, who is in loss and by what amount?

Will post the solution to this puzzle after some time. Till then, let us know your thoughts.

Matchstick game bonanza!!

Problem: There are 'N' matchsticks placed on the table. You and your opponent are to pick any number of matchsticks between 1 and 5. Its your turn first. The one picking the last stick loses the game. You have to device a strategy such that you always win the game.Also, is there any starting number that cannot guarantee that you always win?

Solution: Here, you have to ensure that the control of the game always remains in your hands. Let us approach this problem from the last. The last matchstick has to be picked by your opponent so as to ensure your win. So, your last turn must ensure that there must be only one matchstick left on the table. If this is not the case, say there are 2 matchsticks. Then, your opponent will pick 1 stick and you are left with only one stick to pick and lose the game.
Similarly, one turn before last of your opponent, there must be more than 6 sticks so that he cannot leave you with 1 stick by picking 5 of them. But if there are more than 7 sticks, he may leave you with the same situation by leaving 7 on the table. If you leave 7, the other can at max pick 5 and min 1 leaving any number between 6 and 2 on the table. You can now pick the desired number leaving the last stick to be picked by him. Now, if there were 8 sticks on the table, your opponent would pick 1 leaving you with 7 sticks. :-( Similarly, one turn before, you should have left 13 sticks on the table.

So, your approach should be to leave (6M + 1) sticks on the table always. Ensure that at the end of each round, 6 less matchsticks are there on the table. (For instance, if your opponent picks 3 sticks, you also pick 3).

But there is a catch in this game, if there are already (6M + 1) sticks on the table initially, and its your turn first, you cannot ensure after your first turn the winning strategy. Now, the control goes into the hand of your opponent and you are at the verge of losing the game.

Similarly, 5 can be replaced with any number 'K'. At the end of each turn, you have to ensure there are (K+1)M + 1 sticks left on the table.

Mice and poisonous bottles

Problem: There are 20 bottles filled with water, out of which exactly one is poisonous. We have to figure out the poisonous one. We have, with us, available some mice. When a mice tastes water from a bottle, it dies after exactly half an hour. We have one hour to figure out the poisonous bottle. What approach we should take.                                (Problem source : www.quora.com)

Solution: Each bottle can either be drunk from by a mice or not; i.e., there are two possibilities. We can interpret this as a binary number system problem wherein '1' represents that the mice has drunk from a bottle and '0' represents it has not.

Now, let us approach with a very simple but un-optimized method. Let us have 20 mice, and assign 1 mice to each bottle (1 mice will dring water from a bottle). After half an hour, one of the mice will die. Clearly, we have the culprit bottle. This solution requires 20 mice. But, we can have a better solution as discussed below. Another option can be to choose 1 mouse only. Let it drink from one bottle, wait for half an hour if it dies. If not, let it drink from next bottle. The maximum this approach can take is 10 hours, which is way more than the budget allocated. So, solution 2 is not for this problem.

To represent number 20, we need 5 binary digits. Let us number each bottle with numbers from 1 to 20 and assign binary code representing that number to the bottle. Now, each of the bottles has a unique 5 bit code. We can assume each bit representative of 1 mouse, '1' shows that the mouse will drink water from this bottle, '0' shows otherwise. 

Let us take an example. Bottle '12' will have code '01100', meaning that mouse 2 and 3 will drink water from it. The code for each bottle and respective interpretation is as shown below:


Bottle no Code Interpretation
1 "00000" No mouse will drink water
2 "00001" Mouse 1 will dring water
3 "00010" Mouse 2 will drink water
4 "00011" Mouse 1 and 2 will drink water
5 "00100" Mouse 3 will drink water
6 "00101" Mouse 1 and 3 will drink water
7 "00110" Mouse 2 and 3 will drink water
8 "00111" Mouse 1,2 and 3 will drink water
9 "01000" Mouse 4 will drink water
10 "01001" Mouse 1 and 4 will drink water
11 "01010" Mouse 2 and 4 will drink water
12 "01011" Mouse 1, 2 and 4 will drink water
13 "01100" Mouse 3 and 4 will drink water
14 "01101" Mouse 1, 3 and 4 will drink water
15 "01110" Mouse 2, 3 and 4 will drink water
16 "01111" Mouse 1, 2, 3 and 4 will drink water
17 "10000" Mouse 5 will drink water
18 "10001" Mouse 1 and 5 will drink water
19 "10010" Mouse 2 and 5 will drink water
20 "10011" Mouse 1, 2 and 5 will drink water

Let us say, bottle 15 had poison. So, after half an hour,  mouse 2, 3 and 4 will die as only these mice drank water from this bottle, with the help of which we will come to know that this bottle contained poison.

Measure time using candle!!

Problem statement: You have two candles that can be burnt from both sides. Each candle takes exactly one hour to get burnt completely. You have to measure 45 minutes with the help of these candles. How will you do it?

Solution: Here, we cannot assume that the candle will burn uniformly. So, we cannot  assume that half the candle will get burnt in half an hour and so on. But, if we can somehow let it burn for half an hour, then we can surely assume that the rest will burn in half hour only.




The solution of this puzzle follows:
First, light one of the candles from both sides. Simultaneously, light the other candle from one side only. Now, the first candle will get exhausted in half an hour only as discussed above. After half hour, the other candle has another half an hour left in it. As soon as first candle gets burnt up completely, light the other end of the second candle. Now, the second candle will get exhausted after another 15 minutes as it will burn at twice the rate.

This is how we can measure 45 minutes using two candles that can be burnt from both the sides.