Puzzle Details
you have 3 bags with you, one with pink toys only, one with blue toys only, and one with a mix of two colors. but, the labels on all three bags are wrong. what is the minimum number of draws you would need to make, in order to identify all three bags correctly?
This "Mis-labeled Bags" puzzle is a very famous
interview puzzle. The question is to find out the minimum number of draws to
label the bags correctly. Solving this puzzle is not as hard as it looks.
If you start with a Pink or Blue bag, you may require more draws to identify the correct bags. But we can solve this puzzle in
one single step (one draw) if you start with the bag labeled "pink+blue".
One important thing that you need to remember is that all the bags are labeled
incorrectly at present.
Draw from Bag: Pink+Blue.
Probability 1: Found: Blue
Remember that bag's current label "Pink+Blue" is wrong, so the correct label should be "Blue" as we have got blue from the bag. As we have identified "Blue" bag, move on to bag labelled "pink". Remember that bag's current label "pink" is wrong, hence it should be either "Blue" | "Pink+Blue". Since we have already identified blue bag, then it should be "Pink+Blue". As we have identified both "Blue" and "Pink+Blue", the third bag should be "Pink".
Probability 2: Found:Pink
Remember that bag's current label "Pink+Blue" is wrong, so the correct label should be "Pink" as we have got pink from the bag. As we have identified "Pink" bag, move on to bag labelled "blue". Remember that bag's current label "Blue" is wrong, hence it should be either "Pink" | "Pink+Blue". Since we have already identified "Pink" bag, then it should be "Pink+Blue". As we have identified both "Pink" and "Pink+Blue", the third bag should be "Blue".
watch the below video for a detailed explanation
No comments:
Post a Comment