Oracle

  www.oracle.com
  www.oracle.com

Interview Question

Senior Software Engineer Interview Redwood City, CA

You have 10 boxes of balls (each ball weighing exactly

  10 gm) with one box with defective balls (each one of the defective balls weigh 9 gm). You are given an electronic weighing machine and only one chance at it. How will find out which box has the defective balls?
Answer

Interview Answer

1 Answer

1

Take 1 ball out of the 1st box, 2 balls out of the 2nd, 3 balls out of the 3rd, etc.... and then weigh all of the balls. Then take the total weight = 10*total number balls + x. Solve for x and that will tell you which box is defective.

devpaul on Mar 7, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.