Also called as Jelly Beans problem. One of the most commonly asked puzzle in interviews.
There are 3 jars, all are somehow mislabeled. One jar contains Apple, another contains Oranges and the third jar contains a mixture of both Apple and Oranges.
It is allowed to pick as many fruits as one wants from each jar to fix the labels on the jars. What is the minimum number of fruits that should be picked and from which jars to correctly label them?
Labels on jars are as follows:
We can solve this puzzle quite easily. Let’s take one scenario.
Let us take out one fruit from jar labelled as Apple and Oranges, and you get Apple from the jar. It means that jar has to be Apple since its incorrectly labelled.
So this jar has to have Apples.
Now the jar labelled Oranges has to be Mixed as it cannot be the Oranges jar as they are wrongly labelled and the jar labelled Apple has to be Oranges.
Similar scenario applies if it’s a Oranges taken out from the jar labelled as Apple and Oranges. So you need to pick just one fruit from the jar labelled as Apple and Oranges to correctly label the jars.