We have a scale and 7 balls. 1 ball is heavier than all the
rest. How to determine the heaviest ball with only 3
possible weighing attempts?
Answer Posted / simon y
Sorry guys, you failed the interview, and you got the
question wrong. It is what is the least number of
weighings - the answer is 2 not 3.
1) Take 2 random groups of 3 balls, compare them. If they
are the same you got lucky - the heavier ball is the one
you didn't weigh. If they are different you need step 2
2) Take the 3 heavier balls from weighing 1) and randomly
compare 2 of them. If one is heavier, that is the hevier
ball - if tehy are the same, then the one you didn't weigh
is the heavy one.
Is This Answer Correct ? | 29 Yes | 10 No |
Post New Answer View All Answers
What is oops in programming?
How to use CMutex, CSemaphore in VC++ MFC
How long to learn object oriented programming?
Plese get me a perfect C++ program for railway/airway reservation with all details.
What is object in oop?
Are polymorphisms mutations?
#include
What polymorphism means?
What is overriding in oop?
How Do you Code Composition and Aggregation in C++ ?
What is polymorphism in oops with example?
What are main features of oop?
Is data hiding and abstraction same?
What is the difference between a constructor and a destructor?
What is abstraction in oops with example?