Sunday, November 13, 2011

Fox and Duck Interview Puzzle

A number of different versions of the puzzle are available. For this post we are using the Fox and the Duck version. A duck, pursued by a fox, escapes to the center of a perfectly circular pond. The fox cannot swim, and the duck cannot take flight from the water. The fox is four times faster than the duck. Assuming the fox and duck pursue optimum strategies, is it possible for the duck to reach the edge of the pond and fly away without being eaten? If so, how?

From : Interview Questions and Puzzles

This is not a simple mathematical puzzle to solve like normal common problems. Fox in this puzzle is too fast and clever for any normal and simple strategy.

From the speed of the fox it is obvious that duck cannot simply swim to the opposite side of the fox to escape. Pi*R/4 < R.

Let V be the speed of Duck and 4V speed of fox.

Now we need to find out the position from where duck can swim to the shore in time less then Pi*R/4V. Pi = 3.14.

To keep things simple we will take the distance from center for the duck to escape when the fox is on the exact opposite side of the pond to be R/4.
So duck can swim in 3R/4V which is less than Pi*R/4V.

Now the next challenge is how we can make sure the clever fox will be on the opposite side. Here is the tricky part.

Let the duck rotate around the pond in a circle of radius R/4. Now fox and duck will take exact same time to make a full circle. Now reduce the radius the duck is circling by a very small amount (Delta). Now the Fox will lag behind, he cannot stay at a position as well. Now in due time duck will get to a position we wanted, 3/4*R distance away from shore where fox is on the exact opposite side of the pond. From there duck can swim safely to shore and fly away.

Wednesday, November 9, 2011

Interview Puzzles and Answers

River Crossing Puzzle

Four people need to cross a rickety rope bridge to get back to their camp at night. Unfortunately, they only have one flashlight and it only has enough light left for seventeen minutes. The bridge is too dangerous to cross without a flashlight, and it’s only strong enough to support two people at any given time. Each of the campers walks at a different speed. One can cross the bridge in 1 minute, another in 2 minutes, the third in 5 minutes, and the slow poke takes 10 minutes to cross. How do the campers make it across in 17 minutes?

Solution: Send 1 and 2 first, 1 comes back, send 5 and 10, 2 comes back, send 2 and 1 to the other side.

3 Baskets Puzzle

There are three baskets labeled Orange , Apple, Oracle/Apple. And all of them have wrong labels.How to find the correct label by checking only one basket

Open the Orange/Apple basket. If we get Apple then basket labeled as Orange will be "Orange/Apple" basket.

Thursday, November 3, 2011

25 Horses Puzzle

This is a classic puzzle which can look simple.
Given 25 horses, find the best 3 horses with minimum number of races. Each race can have only 5 horses. You don't have a timer.
Now the challange is how we can do it in 7 races.


We will have 5 races with all 25 horses
Let the results be

Where a1 faster than a2 , a2 faster than a3 etc and

We need to consider only the following set of horses


Race 6
We race a1,b1,c1,d1 abd e1
Let speed(a1)>speed(b1)>speed(c1)>speed(d1)>speed(e1)

We get a1 as the fastest horse
We can ignore d1,d2,d3,e1,e2 and e3


Race 7

Race a2,a3,b1,b2 and c1
The first and second will be second and third of the whole set