Home » » Three mislabeled jars problem Interview Question

Three mislabeled jars problem Interview Question



Three mislabeled jars problem

Puzzle :

This problem is also called Jelly Beans problem. You have three jars that are all mislabeled. one contains apples, another has grapes, and the third has a mix of both. 

Now you are allowed to open any one jar and you can able to see one fruit. [ The jar you are open may contain one fruit or two fruit. but you could able to see only one fruit and you can't find weather the opened jar has one or two fruit].  How could you fix the labels on the jars ?


Variation :

JellyBean

You have three jars that are all mislabeled. one contains peanut butter jelly beans, another grape jelly jelly beans, and the third has a mix of both (not necessarily a 50/50 mix, could be a 1/99 mix or a 399/22 mix). how many jelly beans would you have to pull out, and out of which jars, to find out how to fix the labels on the jars?
|     |        |     |          |     |
|jar 1|        |jar 2|          |jar 3|
|     |        |     |          |     |
=======        =======          =======
  p.b.          grape          p.b./grape
thanks to joel wollman

Answer :

 1. Need to open Apple+Orange jar. If it has apple. then it should be labeled as Apple. The jar which has label Orange should be labeled as "Apple+Orange" and the last one should be "Orange".

2. You have three jars that are all mislabeled. one contains peanut butter jelly beans, another grape jelly jelly beans, and the third has a mix of both (not necessarily a 50/50 mix, could be a 1/99 mix or a 399/22 mix). how many jelly beans would you have to pull out, and out of which jars, to find out how to fix the labels on the jars?
   |     |                  |     |                 |     |
  |jar 1|                |jar 2|               |jar 3|
   |     |                  |     |                 |     |
=======        =======          =======
     p.b.                   grape             p.b./grape
solution: 1 jelly bean from the p.b./grape jar will do the trick.
the trick here is to realize that every jar is mislabeled. therefore you know that the peanut butter jelly bean jar is not the penut butter jelly bean jar, and the same goes for the rest.
you also need to realize that it is the jar labeled p.b./grape, labelled as the mix jar, that is your best hope. if you choose a jelly bean out of there, then you will know whether that jar is peanut butter or grape jelly jelly beans. it can’t be the mix jar because i already said that every jar is mislabeled.
once you know that jar 3 is either peanut butter, or grape jelly, then you know the other jars also. if it is peanut butter, then jar 2 must be mixed because it can’t be grape (as its labelled) and it can’t be peanut butter (that’s jar 3). hence jar 1 is grape.
if jar 3 is grape, then you know jar 1 must be the mix because it can’t be p.b. (as its labelled) and it can’t be grape (that’s jar 3). hence jar 2 is peanut butter.
if you pick jelly beans from jar 1 or jar 2, then you would have to pick out all of the jelly beans before you knew what that jar was. this is because jar 1 and 2 could be the mix, so in order to disprove that they were the mix, you would have to pull out every jelly bean just to make sure (since there could just be one bean of the opposite flavor in there)
Share this on your favourite network

0 comments :

Post a Comment

Like us on Facebook
Follow us on Twitter
Recommend us on Google Plus
Subscribe me on RSS