technology and zen of life

“A heisenbug (named after the Heisenberg Uncertainty Principle) is a computer bug that disappears or alters its characteristics when an attempt is made to study it.”

Puzzle 1 : Take a chill pill!

This is one of the Microsoft interview questions, should be easier to answer as writing a code is not required. 🙂

“You have 5 jars of pills. Each pill weighs 10 gram, except for contaminated pills contained in one jar, where each pill weighs 9 gm. Given a scale, how could you tell which jar had the contaminated pills in just one measurement?”

By scale I mean a digital weight measuring machine.

SOLUTION:

1. Mark the jars with numbers 1, 2, 3, 4, and 5.
2. Take 1 pill from jar 1, take 2 pills from jar 2, take 3 pills from jar 3, take 4 pills from jar 4 and take 5 pills from jar 5.
3. Put all of them on the scale at once and take the measurement.
4. Now, subtract the measurement from 150 ( 1*10 + 2*10 + 3*10 + 4*10 + 5*10)
5. The result will give you the jar number which has contaminated pill.

Leave a Reply

12 Responses

  1. Navinchandra Salunke says:

    Hi

    Now to make it little complex. Consider the same situation with 10 jar with 10 pills…
    We can have same solution. But here we can also have alternate solution…
    Think….

    Regads

    Navin

  2. Venkat says:

    The idea is to form a different weight set from each jar in by picking consecutive numbers from each jar and weighing. If I got 149 then first jar is the one, if I got 148 then the second jar and so on.

  3. Puzzle says:

    Oh Sorry…. I posted in the wrong article

  4. Puzzle says:

    Can i use binary operators in my solution??

  5. DarK says:

    good one.. I never got it correct

  6. Fr0z3n says:

    I have added the answer to the main post. Congratulations to Fiery and Arindam for getting it right.

  7. FieryShadow says:

    correct answer arindam 🙂

  8. arindam says:

    Well this is my solution…..I do not know how to hide this ( tell me someone)

    Solution Hidden

    Well I hope this is correct…..
    Kanishk this is a nice thing u have started…..

  9. Fr0z3n says:

    Fiery got it correct. Thanks for hiding it. Let us see others coming up with the same. 🙂

  10. Gaurav says:

    This was a simple one i guess!

  11. FieryShadow says:

    Solution Hidden

Email Subscription

Disclaimer

The views expressed on this blog are personal. We do not claim to be a representative voice of the views of any organisation whatsoever. We are not responsible for the content present on the blogs to which we have linked.Views expressed are solely that of the author and does not reflect a collective opinion of contributors.
%d bloggers like this: