Mislabeled Bags Interview Puzzle || Amazon Interview Puzzle


Puzzle Details :

There are three bags. The first bag has two blue rocks. The second bag has two red rocks. The third bag has a blue and a red rock. All bags are labeled but all labels are wrong. You are allowed to open one bag, pick one rock at random, see its color, and put it back into the bag, without seeing the color of the other rock. How many such operations are necessary to correctly label the bags ?




Only one operation is required. 
 
u pick a rock from the bag labeled blue and red ... if it's blue then that's the 2 blue rocks bag and likewise for the red. ( since all bags are labeled wrong the one reading blue and red would not actually contain a blue and red rock) 

next, if we get a blue rock from the blue and red labeled bag we know that the bag labeled red has got to be blue and red since we have already used up the blue label and all bags are labeled wrongly then right there standing before us all the time is the bag that contains 2 red rocks.

similarly, if we get 1 red rock from the blue and red labeled bag then the same process repeats itself with the exception here that the blue and red colors are interchanged ...




You may like these posts:

No comments:

Post a Comment