Bloomberg L.P.

  www.bloomberg.com
  www.bloomberg.com

Interview Question

Financial Software Developer Interview New York, NY

There are 10 boxes of apples. Each apple in the boxes

  weights 1 pound, except that one of the boxes contains bad apples, which weights 0.9 pound each. You are given a digital weight (not a scale), and you can take apples out of the boxes. what is the minimum time of weighs to find out which box has bad apples? I gave one solution of 3 times using divide and conquer, but the interviewer said that 1 step is possible. So I couldn`t come up with the solution.
Tags:
brain teaser
Answer

Interview Answer

3 Answers

17

Pick the apples from each box in arithmetic progression starting from 1 apple from the first box. Lets assume that the fourth box is the bad one. So from this box four apples were picked. so the total weight of the apples picked wud be (1+2+3+5+6+7+8+9+10) * 1 + 4 * 0.9 = 54.6. This is 0.4 less than the total weight that wud have been in case all apples were good ie 55 pounds. So digit after the decimal tells us the box from which the bad apples were picked.

Random_dude on Jan 17, 2012
0

the worst case of this process is still n, where is # of boxes, but we can do a lot better than this!

Anonymous on Jun 9, 2012
0

The answer was looking for the best case. Another key thing is that it is a digital scale not a balance scale. So you can measure the weight of each apples. So using two key words, minimum and digital scale, the answer will be one. For example, you take the first apple and measure it's weight on digital scale. The best case will be that the first apple is the one with 0.9 pound.

Anonymous on Jan 16, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.