Not a coding challenge, it was more of a logical problem.
"You are given 7 ball, all equal in size but one is slightly heavier than the other 6. You have to find the heaviest ball and you are allowed to use the scale only twice."

  • 0
    Can I pick the type of scale? Then this one
  • 11
    1. 3 balls on each side of the scale. If the scale is leveled, then the 7th ball is the heaviest
    2. If one side is tilted, then that side has the heaviest. So use the scale again placing one ball on each side. If the scale is leveled, the 3rd is heaviest. Otherwise, the ball which caused the tilt is the heaviest
  • 0
    @siebe it wasn't a long time ago. I remember I got the answer in the end and they gave me a hint. Don't remember what it was.
  • 0
  • 1
  • 6
    Works with up to 9 items.
  • 0
    @Wack works for all odd numbers above 3.
  • 3
    @monrichi alright, do 11...
  • 1
    @Wack oops my bad.
  • 4
    Hit the interviewer with the scales and tell them if they don't tell you the answer, you will hit them again..

    If they don't tell you the second time, you hit them so hard it makes them bleed / die, and then when someone else comes in the room, you say to them, if you don't tell me, the same thing will happen to you too !

    I'm pretty sure they will tell you the answer and it only took you two uses of the scales to find it out. :-)
  • 1
  • 1
    I raise you:
    - 12 balls
    - 1 of them is heavier OR lighter than the others
    - weighing with a scale is allowed 3 times

    Find out which ball is different from the others AND tell for sure if it is lighter or heavier than the others.
Add Comment