Regular visitors of the uTest blog will recall our short-lived ”Tester Challenge” series, which aired for a brief time in 2011 before being cancelled by some stodgy network executives. If it could happen to The Ben Stiller Show, it could happen to any program. Well today, I’m pleased to announce that the series has been relaunched on the uTest Forums. The Tester Challenge series, that is. Sorry Ben Stiller fans.

Our new Tester Challenges Forum is designed to push the boundaries of testers’ creativity, problem solving and critical thinking. So if you’re looking for a puzzle, riddle, testing challenge, or even a tough interview question, you can find it here.

As a sneak preview, I wanted to share one of the recent challenges submitted by a member of our testing community. Take a look:

The logic of this one can be a little tricky, but the really tricky bit is explaining your reasoning, so this is a challenge for both your logic and communication skills:

- There are 3 boxes in front of you
- One box contains only red balls
- One box contains only blue balls
- One box contains both red & blue balls
- There 3 labels (“only red”, “only blue” and “red & blue”) and one label is stuck on each box
- The labels are applied incorrectly (so the contents of a box does not match the label on the box)
- You may pull one ball at a time from any box

The question– What is the minimum number of balls you would need to pull from boxes in order to correctly identify which label belongs on which box? And, for the communication side of things – please explain the reasoning behind the “minimum number” you have chosen.

Thnk you have the answer? Share it in the comments section or answer the riddle in the uTest Forums.

Phil Esposito says

Steps:

1. Take one ball at a time from one box

2. Take one ball at a time from another box.

3. Take one ball at a time from the last box

4 Now it’s time to put all ball back and here is how we do it:

5. Take one red ball and put it into box labeled “only red”

6. Take one blue ball and put it into box labeled “only blue”

7. Take one red ball and put it into box labeled “red&blue”

8. Repeat the instruction in #5

9. Repeat the instruction in #6

10. Take one blue ball and put it into box labeled “red&blue”

11. Continue to fill in all boxes in this manner until all balls are gone and placed in the boxes

Phil Esposito says

Steps:

1. Take one ball at a time from one box

2. Take one ball at a time from another box.

3. Take one ball at a time from the last box

4 Now it’s time to put all ball back and here is how we do it:

5. Take one red ball and put it into box labeled “only red”

6. Take one blue ball and put it into box labeled “only blue”

7. Take one red ball and put it into box labeled “red&blue”

8. Repeat the instruction in #5

9. Repeat the instruction in #6

10. Take one blue ball and put it into box labeled “red&blue”

11. Continue to fill in all boxes in this manner until all balls are back are gone and placed in the boxes

Rajani Kulshrestha says

Assumptions:

1. Boxes are not transparent.

2. user is not allowed to take a peek inside boxes.

3. All boxes have different labels on it.

4. All boxes are incorrectly labelled.

If above assumptions are correct I only need to pull out only 1 ball from box incorrectly labelled ‘Red & Blue’. then I can figure out correct labels for each box without pulling out any ball from any box.

Steps:

1. Take out a ball from box incorrectly labelled ‘Red & Blue’.

2. If the ball is red I can say correct label is ‘Red’ else if the ball is blue the correct label would be ‘Blue’.

3. Now, since one single color box has been identified, I’ll put opposite color label on the box marked with other single color.

i.e. if the 1st box (in step 2 above) had red ball, I’ll put ‘Blue’ label on the box marked ‘Red’ or if the it had blue ball I’ll put label ‘Red’ on the 2nd box.

4. Now the only label left is ‘Red & Blue’ which I’ll put on the third box left.

Done!

Srinidhi Narayana says

According to me the earliest to find out match the labels for the boxes is after drawing a minimum of 4 balls from the different boxes.

Reason:

Since the labels are incorrect, I would label the boxes as Box1, Box2 and Box3. I will start from Box1 and pick a ball which happens to be “Red”. Then I pick a ball from Box2 which also happens to be “Red”. The ball picked from Box3 happens to be “Blue”. Now I pick again from Box1 and if it happens to be a “Blue” ball then I stop there because Box1 would contain both red and blue balls and label it as “red & blue”, Box2 would be labeled as ” only red” and Box3 would be labeled as ” only blue”.

This is earliest I can reach to a conclusion provided the boxes were arraanged as I had indicated above, However, I would have to draw many more balls to rectify the mistake, if the boxes were arranged differently. The question here was the minimum (mandatory) balls that has to be drawn out of the boxes to make a conclusion on the labels. Definitely one cannot make a conclusion by drawing just 3 balls from the boxes. its a minimum of 4 and above.

Its a minimum of 4 because of the condition that I can draw only ball at a time from each box. If I am allowed to draw more than one ball at a time, then I can also conclude earliest by picking a minimum of 3 balls. In this case, to start with, I pick 2 balls from Box1 and of them one was red and the other was blue which gives me the “red & blue” box and the next ball which I draw from Box2 would be a red one and for which I will label “only red” and Box3 has to be “only blue” from which I need not draw any ball.

sarah says

I think it is also important to clarify whether ‘red and blue’ means balls individually red or individually blue – or whether individual balls have both red and blue colouring at the same time – some of the answers above are assuming that ‘red and blue’ balls are multi-coloured (ie have both red and blue colouring in the one ball.)

If in fact, the balls are individually red, or individually blue, in order to determine the number of balls to be pulled out, you would need to know how many balls are in each box.

Zahid says

Reason for my answer:

Take ball from Box labelled R&B. Now since this box labelled incorrectly , so we will have 2 results either Red or Blue. So , if we get a blue ball, then this box definitely is Blue, n red if we get a red.

let us assume we got blue for now to continue.

Now moving to Box labelled R, It cannot be Red (incorrect lable) and also cannot be blue (we already have one), so only option that remains here is R&B and finally the box B will be R.

Hopeit clarifies.

Cheers!!!

Zahid says

Only 1 ball is required to be pulled from th box labelled R&B.

This will decide what box contains whjat based on what you pull.

Pre condition: All boxes are labelled incorrectly. None of them should be correct

Hitesh says

I agree with Nupoor’s explanation in regards to determining correct label for box mislabeled as “red and blue”. However, his explanation for determining correct labeling of remaining two boxes is faulty and rather incomplete.

To be able to arrive at minimum # of balls needed to be pulled from the remaining 2 boxes, one needs to know the correct ratio of red to blue balls. Suppose the ratio is 1r:2b (2 blue balls for each red ball), then I would need to pull 3 balls out of either of the remaining two boxes. If all 3 turn out to be blue, then the box has all blue balls. If even 1 ball out of 3 turns out be of either color, then the box is “red and blue”. By process of elimination then the 3rd box is what the other 2 boxes are not.

Mathematically, it could be expressed like this:

N = z + 1

where N = Total # of balls to be pulled

z = sum of the ratio of red and blue balls

KN says

1. First ask about the “red & blue” balls. Is it one side red and the other side blue or is it a combination of each type of the red & the blue balls.

2. After finding out this information then you can assume that if you can only remove 1 of them, otherwise you would have to look inside of the box to see if there are also re/blue balls in the box without removing the second one to represent the red & blue balls. Visual would be very important to determine the third box.

3. Assuming that only 1 ball can be removed from each box (assuming the red & blue balls would be combined into one ball) then you would remove each ball and place this ball in front of the box it was removed. (Hopefully it doesn’t roll around on the desk)

4. Looking at the labels, determine if any of the balls are actually labelled correctly. Never assume the obvious.

5. Next, for those boxes that are not labelled correctly go back to the printer and ask for new labels for those/all boxes. If you are not able to print them off yourself.

6. Re-label the boxes correctly (if you are required to). I would think that since the boxes are in front of you then they would want you to re-label the boxes for them.

7. Notify packaging as soon as you have your results (Step # 4) that the incorrect labels are being put on the boxes since they will have to re-adjust(change the label locations) on the production line for this error. And request that they write up new labels for those that have already run.

8. Suggest that they have 1 person dedicated to this task of opening and re-labeling, if needed. This would depend on how long the production line has been running incorrectly.

9. Write up the results of your testing so they would know that this has been tested and you have notified the proper personnel for the fix.

Next.

Nupoor says

Hi,

The answer lies within this statement “The labels are applied incorrectly (so the contents of a box does not match the label on the box)” .This is the most important statement in the puzzle/requirement given to arrive at the reasoning.

First pick a ball from the box labeled ‘red and blue’. We know this box actually contains ‘only red’ or ‘only blue’ because if it had both red and blue balls it would not be labeled ‘red and blue’.

If you picked a blue ball ,it’s the ‘only blue’ box or if you picked a red ball it is the ‘only red’ box. For illustration let’s say we picked a red ball from this box, hence this box is actually ‘only red’ box.

Now let’s consider the other 2 boxes. They will be labeled ‘only red’ or ‘only blue’. The box labeled ‘only blue’ will be either ‘only red’ or ‘red and blue’ .It cannot be ‘only red’ as we already have figured out the ‘only red’ box. It has to be ‘red and blue’. The third box remaining will be ‘only blue’ box.

From the illustration above

The box labeled ‘red and blue’ is ‘only red’

The box labeled ‘only blue’ is ‘red and blue’

The box labeled ‘only red’ is ‘only blue’

Hence for the whole exercise we would need to pull out only 1 ball and rest is logical reasoning.

Rob Healy says

Assumptions:

i. The colour of the balls in each box cannot be easily observed

ii. Only read and blue balls exist

iii. There are X blue balls and Y red balls in the mixed box, where the ratio of X:Y is unknown but is not zero (i.e. they’ve not been mean and put out two boxes of pure red balls).

Steps:

1. Draw 1 ball from each of the boxes.

One ball will be colour A and two will be colour B. You are now sure that colour A (for example, blue) comes from the pure colour A box. You are not sure which of the other boxes is pure colour B and which one is mixed.

2. Pull another ball from one of the colour B boxes.

If it is colour A then you know the mixed box and you are done (Hooray!). If not it could still be either of the boxes

3. Pull another ball from the second of the colour B boxes.

The reason behind alternating your search between boxes is that each time you remove one ball from the mixed box you increase your likelihood of finding a colour A ball. You do not know which box contains the colour A balls so it’s the same as the combinatorial problem (n+m)!/(n+m-1)!, where n is the number of a balls in the first box and m is the number of balls in the second box.

Answer:

If you are a lucky dude, then you should be done in 4 balls. And join Trisha for a marrgarita

If the number of balls are high and the ratio X;Y is very large, then you could be drawing balls for a very long time.

- Rob

Morten Thomas says

First thought: Begin with one from each box; you will get one ball of one color and two balls of the other (if you get three balls all the same color the start condition is not fulfilled).

Second thought: How many ways is it possible to place those labels? The answer is 6: 1 all correct, 3 with one correctly place and two has swaped, and 2 with all three incorrectly placed. With balls of two different colors, it should be possible to draw only one.

Which box to draw from? The mixed one is obvious: it will not contain both colors so the box will be of the drawn color only.

If red, then the box marked ‘Red’ will contain blue balls only (cannot be mixed, as the last box will then be labeled ‘Blue’ and contain blue balls only – and that is a no-go).

If blue, the the box marked ‘Blue’ will contain red balls only.

Back to a point from my first thought: Start condition. We have to trust someone who has validated the start condition: tip over all the boxes, get to the bottom of things avoiding a layer of red balls in top of the mixed box. But that is when testing. This is a mind puzzle.

Srivatsan says

Sorry that was wrong,

assuming all 3 are incorrect and every box contains 6 each then i will require 12 balls.

Reason:

terms: Red Box=RB,BlueBox=BB,Red and Blue Box=RBB,Red ball=R Blue Ball=B.

RB=6B,BB=3R3B, RBB=6R

From RBB ihave to remove 3R and place into RB(3 Balls)

From RB remove 6B and Place into RBB and BB equally(6balls)

From BB remove 3R and Place in RB (3 Balls)

total 12.

Srivatsan says

You are asking how minimum many number of balls will i have to pick out. But you have not mentioned how many balls are there in total box wise. and how many boxes are present as incorrect. if all 3 are incorrect and every box contains 6 each then i will require 12 balls. as minimum i will need to remove 15 balls

Anindita says

1. Draw 1 ball.

2. If the color is Blue -> the Box has to be Mixed(red n blue). The box cannot be Blue-(remember the label is incorrect)

3. Interchange the label of this box with the label saying ‘Mixed’.

3. Now interchange the lables of the other 2 boxes(remember the labels are incorrect).

Trisha says

Some are putting conditions not in the instructions & making this way too complicated.

Step 1: Remove ball from box labelled “Red & Blue”; if Red, label Red; if Blue, label Blue

Step 2: Remove ball from box second box. If Red, label Red & Blue. If Blue, pull from alternating boxes until a Red ball is pulled & label that box Red & Blue.

Step 3: Margarita time!

Bob says

For the sake of answering the question I am making the following assumptions:

1. the boxes are not transparent or open.

2. the boxes contain only red or blue balls

The minimum number of balls that you can pick to determine if the labels are correct is 3 provided the assumptions following each ball selected is true.

Step 1: pick a ball from the box labelled “red only”. Assume that the ball you pulled is blue, you now know that this box is labelled incorrectly.

Step 2: pick another ball from the box labelled “red only”. Assume that the ball you pulled is red, you now know that this box should be labelled “red and blue”.

Step 3: pick a ball from the box labelled “blue only”. Assume the ball you pulled is red, you now know that this box is labelled incorrectly and should be labelled “red only”

Step 4: Move the “blue only” label to the box that was originally labelled “red only”.

You don’t want to pull your first ball from the box labelled “red and blue” because it will not help you determine if the box is labelled incorrectly.

Gunaseelan says

I am not sure whether this the right answer !

Picking up only one ball is enough . They have clearly mentioned in the Question that there are 3 varieties of balls

1) Red

2) Blue

3) Red and Blue

If my assumption is correct, item # 3 is ball with both the colours Red and blue and not a single coloured ball.

Is this right ?

Richard Luongo says

1 from each box!

From the problem I am assuming that one box had pure red balls, one box gad pure blue balls and the third box has balls each colored red and blue.

Bruce says

If a developer tells you “All widgets are related to one and only one gadget,” do you believe them? I’d dump the boxes

Ray Pello says

(double post, but my point is to take only 1 ball from the mix)

I have to agree with some of the comments. There are several condition to be fulfilled :

1. If the box is open / transparent then I don’t need to pull any (0). I can see inside the box

2. If I can’t see the inside I might need to get only 1 ball minimum. 1 ball from 1 box. The rest of the boxes I will label with deduction.

Here’s how :

- Assume box 1 (labeled blue), 2 (labeled blue and red), 3 (labeled red). I’ll call box 1 2 3 and the label is blue, mix, red, respectively.

- The labels are ALL applied incorrectly. This means the 1/2/3 box are not what they are. So I try to see from box 2 (mix) first.

- If I get a red ball from box 2, then it’s actually the RED box. Put label appropriately. Now where should I put mix? It should be in box 1 (blue). Why? Because the label there is wrong. So now it will be box 1 (becomes mix), box (2 becomes red), and box 3 (becomes blue)

- If I get a blue ball from box 2, then it’s actually the BLUE box. Put label appropriately. So now it will be box 1 (becomes red), box (2 becomes blue), and box 3 (becomes mix)

Hope it helps

Ray Pello says

I have to agree with some of the comments. There are several condition to be fulfilled :

1. If the box is open / transparent then I don’t need to pull any (0). I can see inside the box

2. If I can’t see the inside I might need to get only 4 balls minimum. 1 ball from 1 box. The rest of the boxes I will label with deduction.

Here’s how :

- Assume box 1 (labeled blue), 2 (labeled blue and red), 3 (labeled red). I’ll call box 1 2 3 and the label is blue, mix, red, respectively.

- The labels are ALL applied incorrectly. This means the 1/2/3 box are not what they are. So I try to see from box 2 (mix) first.

- If I get a red ball from box 2, then it’s actually the RED box. Put label appropriately. Now where should I put mix? It should be in box 1 (blue). Why? Because the label there is wrong. So now it will be box 1 (becomes mix), box (2 becomes red), and box 3 (becomes blue)

- If I get a blue ball from box 2, then it’s actually the BLUE box. Put label appropriately. So now it will be box 1 (becomes red), box (2 becomes blue), and box 3 (becomes mix)

Hope it helps

Michael Bolton says

None, on the premise that the setup is stated correctly, that Ronnie has performed the test he described, and that Jeff and Bill’s notes have been considered.

Mind, I’d have to be sure that Ronnie isn’t colour blind, that there are only three boxes; that the transparent boxes aren’t roomy enough to conceal differently colored balls; that our notions of red and blue don’t slip into purple (this happened for me in a class just the other day); that this is simply a logic puzzle rather than something safety- or mission-critical (are these nuclear fuel pellets? pills?); that there was sufficient incentive for getting things right, and no severe consequences for getting things wrong; and that my conclusion would be judged fairly.

—Michael B.

Rick Bates says

Three boxes with at least 1 ball… minimum requirement;

box 1 – 1 red ball : labeled red & blue

box 2 – 1 red ball, 1blue ball : labeled blue

box 3 – 1 blue ball : labeled red

move box2 red ball to box3

move box3 blue ball to box1.

2 moves minimum. Spec did not say box labels could be changed, all boxes incorrectly labeled.

Anurag says

•There 3 labels (“only red”, “only blue” and “red & blue”) and one label is stuck on each box; :- This line is confusing me..Can anyone help me out ??

Muhammad Husnain says

First of All I will ask clarification in requirements as below:

1. Is it confirm that all boxes will have wrong labels?

If yes

then

I will just pick one ball from Red and Blue box and correct its label as per ball color and then simply replace labels of other two boxes

if No

then i will ask the no of balls in each box for answer and i will check one complete box; label it and then 2nd box 1/2+1(half=1) and then label it and finally third box will be labeled.

Chris Foley says

The answer is one. Here’s the way to do it:

1) Pick a ball out of the “Both”-labeled box. For illustration purposes, we will say you get a Red ball.

Conclusion: This box contains all Red balls only.

2) You are left with two labels: “Red” and “Blue” with possible contents being: Both or Blue.

3) Since we know that all labels are incorrect, the “Both” label must contain Blue balls only and the “Blue” labeled box must contain both Red and Blue.

Jeff Lucas says

The fourth rule only says that one of the boxes contains both red and blue, but does not specify “only”. As a result, the “red and blue” box could contain red, blue, and one white ball.

Therefore, the answer is indeterminate.

Anshuman says

Yes Manal was correct , Only 1 ball need to pull from the box as all the boxes are labels incorrectly . First pull the ball from box where Red & blue label marked . If you get Red ball then it is a box which contains Red balls and if you get Blue ball then it is a box which contains blue ball……

Manal says

I say minimum is 1 ball assuming that ALL labels are incorrectly put on the boxes. The reasoning for this is:

First pull a ball from the box marked Red & Blue. If you get a red ball then this is the red box if you get a blue ball then this is the blue box.

Then all you need to do with the other 2 boxes is swap the labels.

Scott says

Funny – I was asked this exact question in an interview for internship at Microsoft, circa late 90s.

Bill says

If the boxes are transparent or open, then I need to draw no balls at all, simple observation will suffice to determine the correct label for each box

Ronnie says

The question is somewhat innaccuratly worded. In it’s literal meaning, the aboslute minimum number of drawn balls that will find out the correct placement of all sets in all boxes is 1.

Reason:

The requirements tell us that the content doesn’t match the box labels. No uncertainty in the statement, so it cannot be accidentally be correct.

So with that in mind, select a ball from box labeled Red&Blue.

There are only two possibilites, you pull a Red ball, or a Blue. If the ball is Red, you know that the box contains the Red set of balls. (Assignement says that the Red&Blue set of balls are not in the box with Red&Blue label).

That leaves you with two boxes, Red and Blue, and two set of balls: One set of the colour you didn’t pick, and one set of Red&Blue. Since the single colour set still cannot be in the same box as it’s own colour, it has to be in the opposite one. That leaves the Red&Blue set to be in the box labeled with the colour of the ball you drew. Problem solved in 1 drawing of a ball.

One might assume that the text of the challenge isn’t ment to be interpreted that literally. If the labels are placed randomly and MIGHT be placed correctly, the puzzle gets a bit more complicated, but that’s not what it says, so 1 drawing is enough.

Anantha says

3 balls will be maximum I would be pulling.