Fred went to a hardware store in Boston with Alex, Ben, and George. He noted that a hammer cost ten times as much as a screwdriver and a power saw cost ten times as much as a hammer. The storekeeper said that Ben could buy a power saw, George could buy a screwdriver and Alex could buy a hammer. Based on this what would the storekeeper let Fred buy?
Alex's full name is Alexander and Ben's full name is Benjamin. George was Alex's boss and good friend.
Fred could buy all three (the power saw, hammer and screw driver) since he had $111 with him (a $1 bill - George Washington, a $10 Alexander Hamilton, and a $100 bill - Ben Franklin). Boston is in the USA and therefore uses the US currency I just described.
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?
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.
A farmer lived in a small village. He had three sons. One day he gave $100 dollars to his sons and told them to go to market. The three sons should buy 100 animals for $100 dollars. In the market there were chickens, hens and goats. Cost of a goat is $10, cost of a hen is $5 and cost of a chicken is $0.50.
There should be at least one animal from each group. The farmer’s sons should spend all the money on buying animals. There should be 100 animals, not a single animal more or less! What do the sons buy?
They purchased 100 animals for 100 dollars.
$10 spent to purchase 1 goat.
$45 spent to purchase 9 hens.
$45 spent to purchase 90 chickens.
Two men working at a construction site were up for a challenge, and they were pretty mad at each other.
Finally, at lunch break, they confronted one another.
One man, obviously stronger, said "See that wheelbarrow? I'm willin' to bet $100 (that's all I have in my wallet here) that you can't wheel something to that cone and back that I can't do twice as far. Do you have a bet?"
The other man, too dignified to decline, shook his hand, but he had a plan formulating.
He looked at the objects lying around: a pile of 400 bricks, a steel beam, the 10 men that had gathered around to watch, his pickup truck, a stack of ten bags of concrete mix, and then he finalized his plan.
"All right," he said, and revealed his object.
That night, the strong man went home thoroughly teased and $100 poorer.
What did the other man choose?
He looked the man right in the eye and said "get in."
A duke was hunting in the forest with his men-at-arms and servants when he came across a tree.
Upon it, archery targets were painted and smack in the middle of each was an arrow.
"Who is this incredibly fine archer?" cried the duke. "I must find him!"
After continuing through the forest for a few miles he came across a small boy carrying a bow and arrow.
Eventually the boy admitted that it was he who shot the arrows plumb in the center of all the targets.
"You didn't just walk up to the targets and hammer the arrows into the middle, did you?" asked the duke worriedly.
"No my lord. I shot them from a hundred paces. I swear it by all that I hold holy."
"That is truly astonishing," said the duke. "I hereby admit you into my service."
The boy thanked him profusely.
"But I must ask one favor in return," the duke continued.
"You must tell me how you came to be such an outstanding shot."
How'd he get to be such a good shot?
The boy shot the arrow, then painted the circle around it.
There are n coins in a line. (Assume n is even). Two players take turns to take a coin from one of the ends of the line until there are no more coins left. The player with the larger amount of money wins.
Would you rather go first or second? Does it matter?
Assume that you go first, describe an algorithm to compute the maximum amount of money you can win.
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
First Player picks 14, now row of coins is
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.
Going first will guarantee that you will not lose. By following the strategy below, you will always win the game (or get a possible tie).
(1) Count the sum of all coins that are odd-numbered. (Call this X)
(2) Count the sum of all coins that are even-numbered. (Call this Y)
(3) If X > Y, take the left-most coin first. Choose all odd-numbered coins in subsequent moves.
(4) If X < Y, take the right-most coin first. Choose all even-numbered coins in subsequent moves.
(5) If X == Y, you will guarantee to get a tie if you stick with taking only even-numbered/odd-numbered coins.
You might be wondering how you can always choose odd-numbered/even-numbered coins. Let me illustrate this using an example where you have 6 coins:
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.