# Red balls and blue balls

We are searching data for your request:

Forums and discussions:
Manuals and reference books:
Data from registers:
Wait the end of the search in all databases.
Upon completion, a link will appear to access the found materials.

This problem was raised in a job interview at Google.

We have 6 blue balls, 6 red balls and 2 opaque barrels in which it is not possible to see the content.

All balls must be placed in the barrels and you ask a friend to take a ball out of a random barrel.

What ball distribution maximizes the likelihood of your friend taking out a blue ball?

#### Solution

The best distribution consists of introducing a single blue ball in one of the barrels, so if this is the chosen barrel (with a 50% probability), the chances of taking a blue ball are 100%.

In the other barrel (which our friend will choose with a 50% probability) we will have 6 red and 5 blue balls so the probability of taking a blue ball will be 5/6.

In total, the probability of getting a blue ball is