12

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

Comments
  • 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
    @jespersh yes.
  • 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.
  • 0
    @Nanos lol
  • 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