Visit our sponsor Five Planet Juices  
Home
Microsoft Interview Process
Microsoft HR Questions
Technical Questions
Puzzles/Riddles
Resume Tips and Template
Discuss
Question to Interviewer
Interview Tips
Term Of Use
Site Feedback


Find a jar with a contaminated pill from a set of jars

You have 4 jars of pills. Each pill is a certain weight, except for contaminated pills contained in one jar, where each pill is weight + 1. How could you tell which jar had the contaminated pills in just one measurement?

Add your possible solutions in a comment, I will put the one which will convience me here


Comments:

Solution
By psyang on Tuesday, August 29, 2006 (UMST)

Take 1 pill from jar 1, 2 pills from jar 2, 3 pills from jar 3, and 4 pills from jar 4, then weigh all 10 pills together. The total weight will be 10*weight + k, where k = # of contaminated pills that were measured. Thus, if k=1, the contaminated jar is jar 1, or if k=2, the contaminated jar is jar 2, etc.

 

Another interesting side point. You only need to take pills out of 3 jars (1 from jar1, 2 from jar2, and 3 from jar3). If the weight = 6*weight, then the contaminated jar is jar 1, otherwise proceed as usual. This is how you can determine the contaminated jar in one weighing with the minimal number of pills involved (assuming you can't break up a pill).

Reply to this Comment

Add Your Comment

New Articles
  • Combinations in a character array.
    Write a program that takes input a char array and outputs all the combinations of the characters in the character array.
    Example: consier char array {'a','b','c'}
    the output shouold be abc,cab,bac,acb,cba,bca that is all the combinations of characters 'a','b','c'.


  • N-Queen Problem.
    Write a Program to solve N-Queen Problem.

  • Reverse a string
    Reverse a string using recursive function

  •  

    Most Popular Articles
  • Crazy Guy On The Airplane
    A line of 100 airline passengers is waiting to board a plane. they each hold a ticket to one of the 100 seats on that flight.

  • What are your greatest weaknesses
    Beware - this is an eliminator question, designed to shorten the candidate list. Any admission of a weakness or fault will earn you an “A” for honesty, but an “F” for the interview.

  • Question: Tell me about yourself.
    Many candidates, unprepared for the question, skewer themselves by rambling, recapping their life story, delving into ancient work history or personal matters.

  •  

    New Posts

  • My News Topic 8
    Posted by evashy on 2008 წლის 05 09, პარასკევი (UMST)

  • 3StandwOnsIt
    Posted by undondorade on 2008 წლის 03 09, ოთხშაბათი (UMST)

  • 2SOnKeysOns
    Posted by undondorade on 2008 წლის 02 09, სამშაბათი (UMST)



  •