Analytical Interview Questions
Home C/C++ JAVA Google Microsoft Data structures Puzzles Google
Pages
Resume Tips

 

Question

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

Solution

Follow the steps outlined below:

Step-1: Mark the jars with numbers 1, 2, 3, 4, and 5.

Step-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.

Step-3: Put all of the jars on the scale at once and take the measurement.

Step-4: Now, subtract the measurement from 150 (1*10 + 2*10 + 3*10 + 4*10 + 5*10)

Step-5: The result will give you the jar number which has the contaminated pills.

 

 

Recommended Materials

 

Keywords: