Tuesday, November 08, 2005

Average Salary

Three coworkers would like to know their average salary. However, they are self-conscious and don't want to tell each other their own salaries, for fear of either being ridiculed or getting their houses robbed. How can they find their average salary, without disclosing their own salaries?

Monday, October 03, 2005

King and the bottles of wine

An evil king has 1000 bottles of wine. A neighboring queen plots to kill the bad king, and sends a servant to poison the wine. The king's guards catch the servant after he has only poisoned one bottle. The guards don't know which bottle was poisoned, but they do know that the poison is so potent that even if it was diluted 1,000,000 times, it would still be fatal. Furthermore, the effects of the poison take one month to surface. The king decides he will get some of his prisoners in his vast dungeons to drink the wine. Rather than using 1000 prisoners each assigned to a particular bottle, this king knows that he needs to murder no more than 10 prisoners to figure out what bottle is poisoned, and will still be able to drink the rest of the wine in 5 weeks time. How does he pull this off?

End at the Start

how many places are there on the earth that one could walk one mile south, then one mile west, then one mile north and end up in the same spot? to be precise, let's assume the earth is a solid smooth sphere, so oceans and mountains and other such things do not exist. you can start at any point on the sphere. also, the rotation of the earth has nothing to do with the solution; you can assume you're walking on a static sphere if that makes the problem less complicated to you.

Saturday, October 01, 2005

Sorting

Sort an array of size n containing integers between 1 and K, given a temporary scratch integer array of size K.

Jar with the heaviest pill

You have 5 jars of pills. Each pill weighs 10 gram, except for contaminated pills contained in one jar, where each pill weighs 9 gm. Given a scale, how could you tell which jar had the contaminated pills in just one measurement?

Thursday, September 29, 2005

Burning Island

Willywutang is hanging out on a heavily forested island that's really narrow: it's a narrow strip of land that's ten miles long. let's label one end of the strip A, and the other end B. a fire has started at A, and the fire is moving toward B at the rate of 1 mph. at the same time, there's a 2 mph wind blowing in the direction from A toward B. what can willywu do to save himself from burning to death?! assume that willywu can't swim and there are no boats, jetcopters, teleportation devices, etc.. (if he does nothing, willywu will be toast after at most 10 hours, since 10 miles / 1 mph = 10 hours)

Wednesday, September 28, 2005

Two condoms

TWO CONDOMS, THREE WOMEN

Willywutang would like to have safe sex with three women, any of whom may be carrying an STD. Given two condoms, how can he do so, while ensuring that no STD is passed from one woman (or possibly himself) to another (or to himself)?

A dragon and knight

A dragon and knight live on an island. This island has seven poisoned wells, numbered 1 to 7. If you drink from a well, you can only save yourself by drinking from a higher numbered well. Well 7 is located at the top of a high mountain, so only the dragon can reach it.

One day they decide that the island isn't big enough for the two of them, and they have a duel. Each of them brings a glass of water to the duel, they exchange glasses, and drink. After the duel, the knight lives and the dragon dies.

Why did the knight live? Why did the dragon die?

Tuesday, September 27, 2005

Hummingbird

One train leaves Los Angeles at 15mph heading for New York. Another train leaves from New York at 20mph heading for Los Angeles on the same track. The distance between LA and NY is about 5000 miles. If a bird, flying at 25mph, leaves from Los Angeles at the same time as the train and flies back and forth between the two trains until they collide, how far will the bird have traveled?

Hats

There are 3 black hats and 2 white hats in a box. Three men (we will call them A, B, & C) each reach into the box and place one of the hats on his own head. They cannot see what color hat they have chosen. The men are situated in a way that A can see the hats on B & C's heads, B can only see the hat on C's head and C cannot see any hats. When A is asked if he knows the color of the hat he is wearing, he says no. When B is asked if he knows the color of the hat he is wearing he says no. When C is asked if he knows the color of the hat he is wearing he says yes and he is correct. What color hat and how can this be?

Why do you think you are smart

The fork in the road

At a fork in the road between two cities, you see 2 people. One always tells the truth, and comes from the city of safety. The other person always lies and comes from the city of cannibals, where they will eat you. They both look exactly the same. You must choose one of the persons, and ask him one and only one question (no compound questions either, such as "is this shirt red and which way to safety?"). What question could you ask to find out which path leads to the city of safety?

Monday, September 26, 2005

Arabs and camels

An Arab sheikh is old and must will his fortune to one of his two sons. He makes a proposition. His two sons will ride their camels in a race, and whichever camel crosses the finish line last will win the fortune for its owner. During the race, the two brothers wander aimlessly for days, neither willing to cross the finish line. In desperation, they ask a wise man for advice. He tells them something; then the brothers leap onto the camels and charge toward the finish line. What did the wise man say?

True or false

TRUE OR FALSE LIST Consider a list of 2000 statements:


1) Exactly one statement on this list is false.
2) Exactly two statements on this list are false.
3) Exactly three statements on this list are false.
. . .
2000) Exactly 2000 statements on this list are false.

Which statements are true and which are false?

What happens if you replace "exactly" with "at least"?

What happens if you replace "exactly" with "at most"?

What happens in all three cases if you replace "false" with "true"?

Partially filled glass of water

You are in an empty room with one partially filled glass of water in the room. You cannot go out of the room. And you do not have any thing else with you.

How will you tell for sure whether the partially filled glass of water is Half filled or not. i.e. you have to say whether it is half filled/less that half filled/more than half filled.

Manhole covers

Why are manhole covers round ?

Gold chain puzzle

You've got someone working for you for seven days and a gold bar to pay them. The gold bar is segmented into seven connected pieces. You must give them a piece of gold 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?

How many cars are there in the USA

How many cars are there in the USA? You are sitting in an interview room so ofcourse you do not have access to the US census reports.

Measure 4 quarts

If you had an infinite supply of water and a 5 quart and 3 quart pail, how would you measure exactly 4 quarts?

Which ball is heavy

Suppose you had 8 billiard balls, and one of them was slightly heavier, but the only way to tell was by putting it on a scale against another. What's the fewest number of times you'd have to use the scale to find the heavier ball?

Three light bulbs and switches

There is a room with a door (closed) and three light bulbs. Outside the room there are three switches, connected to the bulbs. You may manipulate the switches as you wish, but once you open the door you can't change them. Identify each switch with its bulb

Apples oranges in basket puzzle

There are three closed and opaque cardboard boxes. One is labeled "APPLES", another is labeled "ORANGES", and the last is labeled "APPLES AND ORANGES". You know that the labels are currently misarranged, such that no box is correctly labeled. You would like to correctly rearrange these labels. To accomplish this, you may draw only one fruit from one of the boxes. Which box do you choose, and how do you then proceed to rearrange the labels?