You have just purchased a small company called Company X. Company X has N employees, and everyone is either an engineer or a manager. You know for sure that there are more engineers than managers at the company.
Everyone at Company X knows everyone else's position, and you are able to ask any employee about the position of any other employee. For example, you could approach employee A and ask "Is employee B an engineer or a manager?" You can only direct your question to one employee at a time, and can only ask about one other employee at a time. You're allowed to ask the same employee multiple questions if you want.
Your goal is to find at least one engineer to solve a huge problem that has just hit the company's factory. The problem is so urgent that you only have time to ask N-1 total questions.
The major problem with questioning the employees, however, is that while the engineers will always tell you the truth about other employees' roles, the managers may lie to you if they like. You can assume that the managers will do their best to confuse you.
How can you find at least one engineer by asking at most N-1 questions?
You can find at least one engineer using the following process:
Put all of the employees in a conference room. If there happen to be an even number of employees, pick one at random and send him home for the day so that we start with an odd number of employees. Note that there will still be more engineers than managers after we send this employee home.
Then call them out one at a time in any order. You will be forming them into a line as follows:
If there is nobody currently in the line, put the employee you just called out in the line.
Otherwise, if there is anybody in the line, then we do the following. Let's call the employee currently at the front of the line Employee_Front, and call the employee who we just called out of the conference room Employee_Next.
So ask Employee_Front if Employee_Next is a manager or an engineer.
If Employee_Front says "manager", then send both Employee_Front and Employee_Next home for the day.
However, if Employee_Front says "engineer", then put Employee_Next at the front of the line.
Keep doing this until you've called everyone out of the conference room. Notice that at this point, you'll have asked N-1 or less questions (you asked at most one question each time you called an employee out except for the first employee, when you didn't ask a question, so that's at most N-1 questions).
When you're done calling everyone out of the conference room, the person at the front of the line is an engineer. So you've found your engineer!
But the real question: how does this work?
We can prove this works by showing a few things.
First, let's show that if there are any engineers in the line, then they must be in front of any managers.
We'll show this with a proof by contradiction. Assume that there is a manager in front of an engineer somewhere in the line. Then it must have been the case that at some point, that engineer was Employee_Front and that manager was Employee_Next. But then Employee_Front would have said "manager" (since he is an engineer and always tells the truth), and we would have sent them both home. This contradicts their being in the line at all, and thus we know that there can never be a manager in front of an engineer in the line.
So now we know that after the process is done, if there are any engineers in the line, then they will be at the front of the line. That means that all we have to prove now is that there will be at least one engineer in the line at the end of the process, and we'll know that there will be an engineer at the front.
So let's show that there will be at least one engineer in the line. To see why, consider what happens when we ask Employee_Front about Employee_Next, and Employee_Front says "manager". We know for sure that in this case, Employee_Front and Employee_Next are not both engineers, because if this were the case, then Employee_Front would have definitely says "engineer". Put another way, at least one of Employee_Front and Employee_Next is a manager. So by sending them both home, we know we are sending home at least one manager, and thus, we are keeping the balance in the remaining employees that there are more engineers than managers.
Thus, once the process is over, there will be more engineers than managers in the line (this is also sufficient to show that there will be at least one person in the line once the process is over). And so, there must be at least one engineer in the line.
Put altogether, we proved that at the end of the process, there will be at least one engineer in the line and that any engineers in the line must be in front of any managers, and so we know that the person at the front of the line will be an engineer.
In classic mythology, there is the story of the Sphinx, a monster with the body of a lion and the upper part of a woman.
The Sphinx lay crouched on the top of a rock along the highroad to the city of Thebes, and stopped all travellers passing by, proposing to them a riddle.
Those who failed to answer the riddle correctly were killed.
This is the riddle the Sphinx asked the travellers: "What animal walks on four legs in the morning, two legs during the day, and three legs in the evening?"
This is part of the story of Oedipus, who replied to the Sphinx, "Man, who in childhood creeps on hands and knees, in manhood walks erect, and in old age with the aid of a staff."
Morning, day and night are representative of the stages of life.
The Sphinx was so mortified at the solving of her riddle that she cast herself down from the rock and perished.
Three people check into a hotel room. The bill is $30 so they each pay $10. After they go to the room, the hotel's cashier realizes that the bill should have only been $25. So he gives $5 to the bellhop and tells him to return the money to the guests. The bellhop notices that $5 can't be split evenly between the three guests, so he keeps $2 for himself and then gives the other $3 to the guests.
Now the guests, with their dollars back, have each paid $9 for a total of $27. And the bellhop has pocketed $2. So there is $27 + $2 = $29 accounted for. But the guests originally paid $30. What happened to the other dollar?
This riddle is just an example of misdirection. It is actually nonsensical to add $27 + $2, because the $27 that has been paid includes the $2 the bellhop made.
The correct math is to say that the guests paid $27, and the bellhop took $2, which, if given back to the guests, would bring them to their correct payment of $27 - $2 = $25.
You can easily "tile" an 8x8 chessboard with 32 2x1 tiles, meaning that you can place these 32 tiles on the board and cover every square.
But if you take away two opposite corners from the chessboard, it becomes impossible to tile this new 62-square board.
Can you explain why tiling this board isn't possible?
Color in the chessboard, alternating with red and blue tiles. Then color all of your tiles half red and half blue. Whenever you place a tile down, you can always make it so that the red part of the tile is on a red square and the blue part of the tile is on the blue square.
Since you'll need to place 31 tiles on the board (to cover the 62 squares), you would have to be able to cover 31 red squares and 31 blue squares. But when you took away the two corners, you can see that you are taking away two red spaces, leaving 30 red squares and 32 blue squares. There is no way to cover 30 red squares and 32 blue squares with the 31 tiles, since these tiles can only cover 31 red squares and 31 blue squares, and thus, tiling this board is not possible.
Four people come to an old bridge in the middle of the night. The bridge is rickety and can only support 2 people at a time. The people have one flashlight, which needs to be held by any group crossing the bridge because of how dark it is.
Each person can cross the bridge at a different rate: one person takes 1 minute, one person takes 2 minutes, one takes 5 minutes, and the one person takes 10 minutes. If two people are crossing the bridge together, it will take both of them the time that it takes the slower person to cross.
Unfortunately, there are only 17 minutes worth of batteries left in the flashlight. How can the four travellers cross the bridge before time runs out?
The two keys here are:
You want the two slowest people to cross together to consolidate their slow crossing times.
You want to make sure the faster people are set up in order to bring the flashlight back quickly after the slow people cross.
So the order is:
1-minute and 2-minute cross (2 minute elapsed)
1-minute comes back (3 minutes elapsed)
5-minute and 10-minute cross (13 minutes elapsed)
2-minute comes back (15 minutes elapsed)
1-minute and 2-minute cross (17 minutes elapsed)
100 men are in a room, each wearing either a white or black hat. Nobody knows the color of his own hat, although everyone can see everyone else's hat. The men are not allowed to communicate with each other at all (and thus nobody will ever be able to figure out the color of his own hat).
The men need to line up against the wall such that all the men with black hats are next to each other, and all the men with white hats are next to each other. How can they do this without communicating? You can assume they came up with a shared strategy before coming into the room.
The men go to stand agains the wall one at a time. If a man goes to stand against the wall and all of the men already against the wall have the same color hat, then he just goes and stands at either end of the line. However, if a man goes to stand against the wall and there are men with both black and white hats already against the wall, he goes and stands between the two men with different colored hats. This will maintain the state that the line contains men with one colored hats on one side, and men with the other colored hats on the other side, and when the last man goes and stands against the wall, we'll still have the desired outcome.
It was a grandeur party. In order to filter the uninvited guests, the security guard was assigned a task to check the secret password. The guests invited by the royal family also were shared with the secret password.
John wasn't an invited guest. He learned that the password is needed to make an entry. He hides himself and started watching the guests and the security.
The first guest comes. Security told him, TWELVE and the guest replied SIX. He wished him and allowed him to enter.
The second guest comes. Security told him SIX and the guest replied THREE! He was too allowed.
John made an entry as third guest. Security told him EIGHT and John replied FOUR. He was thrown out of the party!
The answer should be five. The password is not half of the digit, but the number that represents the number of digits told by security.
A man needs to send important documents to his friend across the country. He buys a suitcase to put the documents in, but he has a problem: the mail system in his country is very corrupt, and he knows that if he doesn't lock the suitcase, it will be opened by the post office and his documents will be stolen before they reach his friend.
There are lock stores across the country that sell locks with keys. The only problem is that if he locks the suitcase, he has no way to send the key to his friend so that the friend will be able to open the lock: if he doesn't send the key, then the friend can't open the lock, and if he puts the key in the suitcase, then the friend won't be able to get to the key.
The suitcase is designed so that any number of locks can be put on it, but the man figures that putting more than one lock on the suitcase will only compound the problem.
After a few days, however, he figures out how to safely send the documents. He calls his friend who he's sending the documents to and explains the plan.
What is the man's plan?
The plan is this:
1. The man will put a lock on the suitcase, keep the key, and send the suitcase to his friend.
2. The friend will then put his own lock on the suitcase as well, keep the key to that lock, and send the suitcase back to the man.
3. The man will use his key to remove his lock from the suitcase, and send it back to the friend.
4. The friend will remove his own lock from the suitcase and get to the documents.
Search: Man-in-the-middle attack
An infinite number of mathematicians are standing behind a bar. The first asks the barman for half a pint of beer, the second for a quarter pint, the third an eighth, and so on. How many pints of beer will the barman need to fulfill all mathematicians' wishes?
In a far away land, it was known that if you drank poison, the only way to save yourself is to drink a stronger poison, which neutralizes the weaker poison.
The king that ruled the land wanted to make sure that he possessed the strongest poison in the kingdom, in order to ensure his survival, in any situation. So the king called the kingdom's pharmacist and the kingdom's treasurer, he gave each a week to make the strongest poison. Then, each would drink the other one's poison, then his own, and the one that will survive, will be the one that had the stronger poison. The pharmacist went straight to work, but the treasurer knew he had no chance, for the pharmacist was much more experienced in this field, so instead, he made up a plan to survive and make sure the pharmacist dies.
On the last day the pharmacist suddenly realized that the treasurer would know he had no chance, so he must have a plan. After a little thought, the pharmacist realized what the treasurer's plan must be, and he concocted a counter plan, to make sure he survives and the treasurer dies. When the time came, the king summoned both of them. They drank the poisons as planned, and the treasurer died, the pharmacist survived, and the king didn't get what he wanted. What exactly happened there?
The treasurer's plan was to drink a weak poison prior to the meeting with the king, and then he would drink the pharmacist's strong poison, which would neutralize the weak poison. As his own poison he would bring water, which will have no effect on him, but the pharmacist who would drink the water, and then his poison would surely die. When the pharmacist figured out this plan, he decided to bring water as well. So the treasurer who drank poison earlier, drank the pharmacist's water, then his own water, and died of the poison he drank before. The pharmacist would drink only water, so nothing will happen to him. And because both of them brought the king water, he didn't get a strong poison like he wanted.