A Microsoft job interview question. What's your answer?

Hey, it’s lunchtime somewhere.

I just have to give out the answer to this one, but I’ll put it in a spoiler box in case anyone would like to figure it out on their own.

[Spoiler]
The absolute minimum number is 3.
Let’s label the cans A, B, and C for clarity’s sake.

Pull one marble out of can A. Say that marble is black. You now know that A is either all black or the black/white mix.

Pull two marbles out of can B. If they are different colors, you know that A is all black, C is all white, and B is the mixture.

Obviously, this will not work unless the can you pull two marbles out of is the can with the mixture of black and white. [/Spoiler]

I couldn’t see your last sentence in the spoiler box before I wrote this so I will include what I wrote anyway so that others can see it.

Your approach would work if you read the question as what is the smallest number possible of marbles that you can pull out and determine what is each can. However, your approach requires luck for it to work. There is a fifty-fifty chance that you will pull out two marbles of the same color even if you choose from the mixed bucket. That still leaves you in the unknown position for all of the cans.

Most of the puzzles of this nature want you to find out the fewest number of draws it would take for you to know with certainty what is each can.

It depends on what they mean by the question. It is ambigous the way it is worded. I guess if this was a real interview question, the best answer would to include both approaches.

Does anyone get the “four women crossing a bridge” problem.

Unless the answer involves one woman carrying a slower one, I can’t see how it could be done in less than 19 minutes

(10+5+2 going one way and 2 for the two return trips the one min. woman will take to walk the flashlight back.)

Correct. Actually, if my math is correct, my method would only work about 17% of the time. And I’m guessing the question was worded ambigously on purpose, to see if the interviewee can see the need for clarity in the question before providing the answer.

To determine the makeup of the three cans with absolute certainty:

You will need to draw 101 marbles out of can A and 101 out of can B. This is necessary because it’s possible (although extremely unlikely) that you’ll draw all 100 black marbles out of the black/white can before drawing the first white marble.

So, depending on the meaning of the question, you’d need between 3 and 202 marbles to determine the makeup of the three cans.

Ok, I am going to make a fool of myself by posting my answer for the three cans filled with marbles puzzle posted by BurnMeUp.

I say that the answer is 202 for a guaranteed success on every trial.

Here is my methodology:

  1. Pull one marble out of can A. It doesn’t matter what color you get. Just make note of it. Let’s assume that it is black.
  2. Pick either of the two other cans. We will pick can C.
  3. Pull a marble out of C. It comes out white. You still don’t know much at this point because A, B, or C could be the mixed can.
  4. I set it up on paper with the most unlucky scenario possible and the only way out that I could find that would work on every trial is to pick either can A or Can C and draw the next 100 marbles. That means that 101 marbles out of the orginal 200 have been drawn and you are guaranteed to find out if that is the mixed bucket or not.
  5. If it is not the mixed bucket, then you still don’t know if A or B is the mixed bucket. You pick A because you have already drawn one marble out of it. You must draw 100 more marbles out of it to find out if it is the mixed bucket or not (for a total of 101). Let’s assume that we know the C is black and A is mixed. That leaves B that is white.

Grand total = 202 marbles drawn

That is the brute force method that ensures a win even if the worst possible scenerio happens. With these puzzles, brute force is rarely the correct answer so someone please tell me if I went wrong somewhere.

I looked for the solution to this puzzle and similar marble questions came up but the scenarios were different. Could it be that this is a corrupted version of those puzzles that really does not have an elegant solution?

And what pray tell is that?

I always figured that the correct response was, “oh no, not one of these questions.” That way, you both know that there’s a game going on and you’d rather not play but if he wants to press it, you’re willing.

I’m not sure 202 marbles is the right answer.

Pull one marble out of each container, see the color of each. You will have two of one and one of the other, set the single color container aside.

Pull an additional hundred out of one of the containers that had the color with two marbles.

By the hundreth marble you know whether that one is the single or mix.

so I’d say 103 marbles and you’d know for sure.

No - you’re off still

[spoiler]and spending a lot more time drawing marbles than is necessary. You can do it in 103 draws. Max.
Here are the possible combos (M)ix, (W)hite, (B)lack
1 - B, W, M
2 - B, M, W
3 - W, M, B
4 - W, B, M
5 - M, B, W
6 - M, W, B

you draw the first marble from the first can - for ease, we’ll say that it’s b. So, you’re dealing with possible combos 1,2,5, & 6.

draw the second marble out of the second jar. If it’s also black - you know that jar 3 is all white. So, now you’ve got combos 2 or 5. You then draw up to another 100 marbles out of the second jar. If none of those are white - you know that jar 2 is black (combo 5). If any of them are white, combo 2. Total maximum right now is 102 marbles.

but, if the second marble out of the second jar is white, you are dealing with combo 1, 2, or 6. So, you move to the third jar… draw a marble. If that marble is black, combos 1 or 6. Draw up to 100 more out of the third jar - if none of them are white you’ve got combo 6. If any of them turn up white, combo 1. Similarly, if the first marble you draw out of the third jar is white, you’ve got combo 1 or combo 2. Keep drawing up to another hundred out of the third jar… if any of them turn up black, you have combo 1. If they’re all white, you have combo 2.

You’re done. At 103 draws (1 from jar 1, 1 from jar 2, up to 101 from jar 3.)
[/spoiler]

Originaly posted by amarinth
paraphrased by me

That’s what I said. :slight_smile:

God this one was annoying. Anyway:
1&2 cross (2 min)
2 goes back (2 min)
5&10 cross (10 min)
1 goes back (1 min)
1&2 cross (2 min)

Interviewer hands you a black pen and says nothing but “This pen is red.”
“No it’s not, it’s stuck into your neck (stabs pen through interviewers jugular) Oh, now it is red. I like Macs. This interview is over.” :smiley:

“CTL, ALT, DEL.”

Thanks ararinth and wolfman . You are correct. I made a wrong turn in the beginning and didn’t think of pulling one from each can until later. I am still surprised that the answer is that high though. Yours is still a brute force method. Usually, these types of questions use some sort of logical magic that lets you solve the puzzle in, say, ten moves or less.

I don’t know, but I would’ve hired you for using the Scooby Doo voice.

I hate that “What would you like to be doing in five years?” questions. Guys, I’m interviewing for an IT position. I haven’t held the same job for over 2 1/2 years my entire professional career. Every three years I’m doing something completely different. How the hell am I supposed to know what I’m going to be doing in five years?

Interviewer: This pen is red.

Smartass Interviewee: What pen? I see no pen. There IS no pen. And when people write in to complain about problems with this pen that doesn’t exist, I’ll put out a patch to fix the pen and pretend I didn’t notice the pen until that moment.
In reality I’d probably just say something like, “Uhhh, what?”

Yeah, and better, too. Oops.

If someone handed me a black pen and told me “This pen is red,” I would take it from them and examine it for writing on it. If I found none, I’d shrug and hand it back, telling them that I can’t read invisible ink, but maybe if they used lemon juice and would lend me their desk lamp…

You can actually do this with 1 pull, if you choose the marble from the bag that is (mis)labled “mixed”. I do this question with both my programming logic and my interviewing classes at the college.
BTW, I got this one wrong when I heard it the 1st time, but got the job anyway because I was able to (1) explain my answer in a decent fashion, and (2) I was able to comprehend and test the actual answer.

After double checking that it wasn’t red ink in black housing, I would tell the interviewer the pen is black.

Smart Ass Response: “You’re right! This pen is red… and these aren’t the droids we’re looking for”