Sunday, 29 May 2016

Measure "4 liter water" problem

We have two buckets, 1 of capacity 3 liter and another of 5 liter. We have 5 liters of water.

So how will we make combinations such that 1 bucket will have exactly 4 liters of water?
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Answer:
Let say Bucket B1 has capacity of 5 Liter and B2 has 3 Liter.)

1.) Full B1 bucket with water. ( B1-5L, B2-0L)
2.) Empty B1 into B2. (B1-2L, B2-3L)
3.) Empty B2 bucket. (B1-2L, B2-0L)
4.) Emty B1 into B2. (B1-0L, B2-2L)
5.) Full B1 bucket. (B1-5L, B2-2L)
6.) Empty B1 into B2. (B1-4L, B2-3L)

Red Blue marble - probability puzzle

We have 50 red marbles, 50 blue marbles and 2 jars. 
One of the jars is chosen at random and then one marble will be chosen from that jar at random. 
How would you maximize the chance of drawing a red marble? What is the probability of doing so? 
All 100 marbles should be placed in the jars.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Answer:
Put a single Red marble in one jar. And rest of 99 in other jar.
Which gives the maximum probability.
= ((1/2)*1)  +  (( 1/2)*(49/99))
= 0.50 + 0.2474
= 0.7474
= 0.75 or 75%

Mislabeled jar - Jelly Beans problem

This problem is also called Jelly Beans problem. This is the most commonly asked interview puzzle.

You have 3 jars that are all mislabeled.
One jar contains Apple, another contains Oranges and the third jar contains a mixture of both Apple and Oranges.
Labels on jars are as follows: Apples, Oranges, Apples+Oranges

You are allowed to pick as many fruits as you want from each jar to fix the labels on the jars.

What is the minimum number of fruits that you have to pick and from which jars to correctly label them?

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Answer:









We 

have 100 coins laying flat on a table, each with a head side and a tail side. 10 of them are heads up and rest of 90 are tails up. 

You can't feel, see or in any other way find out which side is up. 

Split the coins into two piles such that there are the same number of heads in each pile. 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Answer:
Divide all 100 coins into two piles. (irrespective of pile-size)

And flip all the coins in any one pile.

which gives equal number of heads and tails in both piles.

Crossing the bridge puzzle

Adam, Bob, Clair and Dave are out walking:

They come to rickety old wooden bridge. The bridge is weak and only able to carry the weight of two of them at a time. Because they are in a rush and the light is fading they must cross in the minimum time possible and must carry a torch (flashlight,) on each crossing. They only have one torch and it can't be thrown. Because of their different fitness levels and some minor injuries they can all cross at different speeds.

Adam can cross in 1 minute, Bob in 2 minutes, Clair in 5 minutes and Dave in 10 minutes.

What is the minimum time require to cross the bridge?

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Answer:
17 Minutes