A king has 100 identical servants, each with a different rank between 1 and 100. At the end of each day, each servant comes into the king's quarters, one-by-one, in a random order, and announces his rank to let the king know that he is done working for the day. For example, servant 14 comes in and says "Servant 14, reporting in."
One day, the king's aide comes in and tells the king that one of the servants is missing, though he isn't sure which one.
Before the other servants begin reporting in for the night, the king asks for a piece of paper to write on to help him figure out which servant is missing. Unfortunately, all that's available is a very small piece that can only hold one number at a time. The king is free to erase what he writes and write something new as many times as he likes, but he can only have one number written down at a time.
The king's memory is bad and he won't be able to remember all the exact numbers as the servants report in, so he must use the paper to help him.
How can he use the paper such that once the final servant has reported in, he'll know exactly which servant is missing?
When the first servant comes in, the king should write down his number. For each other servant that reports in, the king should add that servant's number to the current number written on the paper, and then write this new number on the paper.
Once the final servant has reported in, the number on the paper should equal
(1 + 2 + 3 + ... + 99 + 100) - MissingServantsNumber
Since (1 + 2 + 3 + ... + 99 + 100) = 5050, we can rephrase this to say that the number on the paper should equal
5050 - MissingServantsNumber
So to figure out the missing servant's number, the king simply needs to subtract the number written on his paper from 5050:
MissingServantsNumber = 5050 - NumberWrittenOnThePaper
Suppose you want to send in the mail a valuable object to a friend. You have a box which is big enough to hold the object. The box has a locking ring which is large enough to have a lock attached and you have several locks with keys. However, your friend does not have the key to any lock that you have. You cannot send the key in an unlocked box since it may be stolen or copied. How do you send the valuable object, locked, to your friend - so it may be opened by your friend?
Send the box with valuable object and a lock attached and locked. Your friend attaches his or her own lock and sends the box back to you. You remove your lock and send it back to your friend. Your friend may then remove the lock she or he put on and open the box.
Search: Man-in-the-middle attack
You have twelve balls, identical in every way except that one of them weighs slightly less or more than the balls.
You have a balance scale, and are allowed to do 3 weighings to determine which ball has the different weight, and whether the ball weighs more or less than the other balls.
What process would you use to weigh the balls in order to figure out which ball weighs a different amount, and whether it weighs more or less than the other balls?
Take eight balls, and put four on one side of the scale, and four on the other.
If the scale is balanced, that means the odd ball out is in the other 4 balls.
Let's call these 4 balls O1, O2, O3, and O4.
Take O1, O2, and O3 and put them on one side of the scale, and take 3 balls from the 8 "normal" balls that you originally weighed, and put them on the other side of the scale.
If the O1, O2, and O3 balls are heavier, that means the odd ball out is among these, and is heavier. Weigh O1 and O2 against each other. If one of them is heavier than the other, this is the odd ball out, and it is heavier. Otherwise, O3 is the odd ball out, and it is heavier.
If the O1, O2, and O3 balls are lighter, that means the odd ball out is among these, and is lighter. Weigh O1 and O2 against each other. If one of them is lighter than the other, this is the odd ball out, and it is lighter. Otherwise, O3 is the odd ball out, and it is lighter.
If these two sets of 3 balls weigh the same amount, then O4 is the odd ball out. Weight it against one of the "normal" balls from the first weighing. If O4 is heavier, then it is heavier, if it's lighter, then it's lighter.
If the scale isn't balanced, then the odd ball out is among these 8 balls.
Let's call the four balls on the side of the scale that was heavier H1, H2, H3, and H4 ("H" for "maybe heavier").
Let's call the four balls on the side of the scale that was lighter L1, L2, L3, and L4 ("L" for "maybe lighter").
Let's also call each ball from the 4 in the original weighing that we know aren't the odd balls out "Normal" balls.
So now weigh [H1, H2, L1] against [H3, L2, Normal].
-If the [H1, H2, L1] side is heavier (and thus the [H3, L2, Normal] side is lighter), then this means that either H1 or H2 is the odd ball out and is heavier, or L2 is the odd ball out and is lighter.
-So measure [H1, L2] against 2 of the "Normal" balls.
-If [H1, L2] are heavier, then H1 is the odd ball out, and is heavier.
-If [H1, L2] are lighter, then L2 is the odd ball out, and is lighter.
-If the scale is balanced, then H2 is the odd ball out, and is heavier.
-If the [H1, H2, L1] side is lighter (and thus the [H3, L2, Normal] side is heavier), then this means that either L1 is the odd ball out, and is lighter, or H3 is the odd ball out, and is heavier.
-So measure L1 and H3 against two "normal" balls.
-If the [L1, H3] side is lighter, then L1 is the odd ball out, and is lighter.
-Otherwise, if the [L1, H3] side is heavier, then H3 is the odd ball out, and is heavier.
If the [H1, H2, L1] side and the [H3, L2, Normal] side weigh the same, then we know that either H4 is the odd ball out, and is heavier, or one of L3 or L4 is the odd ball out, and is lighter.
So weight [H4, L3] against two of the "Normal" balls.
If the [H4, L3] side is heavier, then H4 is the odd ball out, and is heavier.
If the [H4, L3] side is lighter, then L3 is the odd ball out, and is lighter.
If the [H4, L3] side weighs the same as the [Normal, Normal] side, then L4 is the odd ball out, and is lighter.
Two girls ate dinner together.
They both ordered iced tea.
One girl drank them very fast and had finished five in the time it took the other to drink just one.
The girl who drank one died while the other survived.
All of the drinks were poisoned.
How is that possible?
There is a barrel with no lid and some wine in it.
"This barrel of wine is more than half full," said Curly.
Moe says, "No it's not. It's less than half full."
Without any measuring implements and without removing any wine from the barrel, how can they easily determine who is correct?
Tilt the barrel until the wine barely touches the lip of the barrel. If the bottom of the barrel is visible then it is less than half full. If the barrel bottom is still completely covered by the wine, then it is more than half full.