Sunday, December 18, 2011

Reaching the door of Heaven

A person dies, and he arrives at the gate to heaven. There are three doors in the heaven. one of them leads to heaven. another one leads to a 1-day stay at hell, and then back to the gate, and the other leads to a 2-day stay at hell, and then back to the gate. every time the person is back at the gate, the three doors are reshuffled. How long will it take the person to reach heaven?

this is a probability question - i.e. it is solvable and has nothing to do with religion, being sneaky, or how au dente the pasta might be ;-)

Answer:

1/3 of the time, the door to heaven will be chosen, so 1/3 of the time it will take zero days. 1/3 of the time, the 1-day door is chosen; of those, the right door will be chosen the next day, so 1/9 trips take 1 day. Similarly, 1/9 will take two days (choosing the 2-day door, then the right door).

After that, the cases split again, and again, and again. I can’t seem to make a nice infinite sum this way, so let’s try again.

Suppose the average days spent is X. 1/3 of the cases are done in zero days as before. 1/3 of the cases are 1 day plus X. 1/3 are 2 + X. So:

X = 1/3 * 0 + 1/3 * (1 + X) + 1/3 * (2 + X)

  = 0 + 1/3 + X/3 + 2/3 + X/3

  = 1 + 2X/3

Therefore,

  X/3 = 1

    X = 3

On average, it takes three days to get to heaven. Two if the noodles are limp.

Took me one blind alley, and about five minutes.

Can you properly the hotel charges?

Three people check into a hotel. They pay $30 to the manager, and go to their room. The manager finds out that the room rate is $25 and gives $5 to the bellboy to return. On the way to the room the bellboy reasons that $5 would be difficult to share among three people so he pockets $2 and gives $1 to each person. Now each person paid $10 and got back $1. So they paid $9 each, totaling $27. The bellboy has $2, totaling $29. Where is the remaining dollar ? 

 

Solution: True its just a slip of tongue. 3 rooms money paid = $27 = Manager $25 + bellboy $2. Plus $1 to each of them.

Passengers and Random Seats

100 passengers are boarding an airplane with 100 seats.
Everyone has a ticket with his seat number. These 100 passengers boards the airplane in order.
However, the first passenger lost his ticket so he just took a random seat.
For any subsequent passenger, he either sits on his own seat or, if the seat is taken, he takes a random empty seat.
What's the probability that the last passenger would sit on his own seat ?


Solution:
Let us say that everyone is sitting except for the 100th passenger. Consider where can he sit - he can sit in either seat numbered 100 or 1. There cannot be any other seat vacant for him.
We can prove this using contradiction. Lets say that a seat numbered n=55 is vacant for 100th passenger. Since passenger 55 came earlier he should be sitting in his seat if its vacant. So seat 55 cant be vacant. This logic can be applied to all seats except for seat 1 and 100.
So all permutations of the seating arrangement would result in last person sitting in either seat 1 or seat 100. Both the options are equally likely.
So answer = 1/2.

Saturday, December 17, 2011

Fint out the matching socks

Michael have ten pairs of black socks, eight pairs of white socks and seven pairs of green socks. Everything is mixed in a draw. As there is no light he were not able to identify the color of the socks. How many of the socks did he want to take to match one pair ?

Solution:

The answer is 4 since in worst case all 3 socks taken first will be different color then the 4th one would be repetition. However if we consider a left sock to be different from right one, then at least 10 + 8 + 7 + 1 = 26 socks are needed.

How many races required?


You have 25 horses and 5 tracks and you need to find out top 3 horses. What is the minimum number of races required to do this ?


Solution:


For 1st question:
Group 25 horses in 5 groups:
A : A1, A2, A3, A4, A5 [Decreasing order of speeds]
B : B1, B2, B3, B4, B5
C : C1, C2, C3, C4, C5
D : D1, D2, D3, D4, D5
E : E1, E2, E3, E4, E5
Five races will have to take place for ranking in groups themselves.
One race for A1, B1, C1, D1, E1 for ranking of the groups.
Now A1>B1>C1>D1>E1
So A1 is the topper. We now need to find 2 more horses for 2nd and 3rd position.
Here is the key observation.
Selection by Elimination  [We need to find 2 more horses, if any horse is slower than 2 horses except A1 then it can not be included in the solution]
1. D1 and E1 can not be included in the solution as both of them are slower than B1 and C1
and hence their whole group is eliminated as they were best from their groups.
2. A4, A5 can not be included in the solution as they are slower than A2 and A3.
3. B3, B4, B5 can not be included in the solution as they are slower than B1 and B2.
4. C2, C3, C4, C5 can not be included in the solution as they are slower than C1 which is slower than B1 itself.

So we are now having only 5 possible horses for 2 positions which can be found out in just one race. [A2, A3, B1, B2, C1] Top 2 of this group will be ranked 2nd and 3rd after A1.


Saturday, October 8, 2011

Four People on a Rickety Bridge

Question: Four people need to cross a rickety bridge at night. Unfortunately, they have only one torch and the bridge is too dangerous to cross without one. The bridge is only strong enough to support two people at a time. Not all people take the same time to cross the bridge. Times for each person:  1 min, 2 mins, 7 mins and 10 mins. What is the shortest time needed for all four of them to cross the bridge?
Answer: The initial solution most people will think of is to use the fastest person as an usher to guide everyone across. How long would that take? 10 + 1 + 7 + 1 + 2 = 21 mins. Is that it? No. That would make this question too simple even as a warm up question.
Let’s brainstorm a little further. To reduce the amount of time, we should find a way for 10 and 7 to go together. If they cross together, then we need one of them to come back to get the others. That would not be ideal. How do we get around that? Maybe we can have 1 waiting on the other side to bring the torch back. Ahaa, we are getting closer. The fastest way to get 1 across and be back is to use 2 to usher 1 across. So let’s put all this together.
1 and 2 go cross
2 comes back
7 and 10 go across
1 comes back
1 and 2 go across (done)
Total time = 2 + 2 + 10 + 1 + 2 = 17 mins

4 Quarts of Water

Question: If you had an infinite supply of water and a 5 quart and 3 quart pails, how would you measure exactly 4 quarts? and What is the least number of steps you need?

Answer: This question is very simple actually. Since we can’t hold 4 quarts in the 3 quart pail, we have to look to filling up the 5 quart pail with exactly 4 quarts. Lets count the steps as we move along

Answer: This question is very simple actually. Since we can’t hold 4 quarts in the 3 quart pail, we have to look to filling up the 5 quart pail with exactly 4 quarts. Lets count the steps as we move along
1. Fill 3 quart pail ( 5p – 0, 3p – 3)
2. Transfer to 5 quart pail (5p – 3, 3p – 0)
3. Fill 3 quart pail ( 5p – 3, 3p – 3)
4. Transfer to 5 quart pail (5p – 5, 3p – 1)
5. Empty 5 quart pail (5p – 0, 3p – 1)
6. Transfer to 5 quart pail (5p – 1, 3p – 0)
7. Fill 3 quart pail ( 5p – 1, 3p – 3)
8. Transfer to 5 quart pail (5p – 4, 3p – 0) We are done!!!