Amazon Interview Question
Software Engineer / Developerstwo scales of 0-25 and 50-75 are needed.
Any weight between 25-50 &75-100 will be meaesured as follows:
measure two reference weights y1=>(0-25) and y2=>(50-75).
Now,for any unknown weight x, if both (x+y1)&&(x+y2) false=>
x belongs to (75-100) else (25 to 50) group.
correct me if wrong.
Ans is 2
1st Scale category (1-50)
if BULB IS ON
2nd Scale Category (1-25)
if BULB IS ON
Put in Bucket A
if BULB IS OFF
Put in Bucket B
if BULB IS OFF
2nd Scale Category (50-75)
if BULB IS ON
Put in Bucket C
if BULB IS OFF
Put in Bucket D
2 scale needed ..
- awsomist October 03, 20101> 1-50
2> 25-75
if(1==on&&2==on) weight is 25-50
if(1==on&&2==of) weight is 1-25
if(1==of&&2==of) weight is 75-100
if(1==of&&2==on) weight is 50-75