Microsoft Interview Question for Software Engineer in Tests






Comment hidden because of low score. Click to expand.
3
of 3 vote

Assume the ball we need to find is X. Divide into 3 groups, A (27 balls), B (27 balls), C (26 balls)

Step 1: Weight A vs B, whichever is heavier has X. If equal, then C has X. If C has X, choose a random ball in A and put into C so that C has 27 balls.

Step 2: After step 1, we determine which group has X, and the group size is 27. Divide into 3 smaller groups, each of size 9, and repeat the same procedure.

In short, we have, 80 -> 27 -> 9 -> 3 -> 1, 4 steps in total to find X.

- Anonymous May 01, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

4 stesps : in general , if there are n balls , log_3(n) is the answers

- dbguy May 03, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

A harder version of this problem:
Among 8 balls 1 is different (either light or heavy than others). How many rounds are needed?
Answer: 3

- buried.shopno May 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

If its 8 balls, Its possible to find the less weight ball in two steps :

1. Separate 2 balls first.
2. Weight remaining 3-3 balls and if both set are equal
weight other two and you can find less-weight one and END.
If both are not same - take less set.
3. Separate 1 ball and take other two and weight those.

- Sambit.Sarkar May 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1. Divide into groups of 27, 27 and 26
2. Weight 27 against 27, its either group with 27 or 26. For Ex, lets take 27
3. Divide into 9, 9 and 9
4. Weigh 9 against 9, we know group 9 balls which are heavier
5. Now divide them into 3,3,3
6. Similarly we will end up with group of 3
7. Divide into 1, 1, 1
7. Now compare 1 and 1...U know the answer


4 Steps! he he

- nagabhushana.s July 01, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@buried.shopno...this kind of question i have come across...but i don't know how to find..i mean i know the solution when one ball is defective and we know ball is heavy or light but what about if we don't know ball is heavy or light

- Anonymous September 09, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1. Divide it into 30-30-20 & weigh 30-30.( WEIGH 1)
2. IF 30-30 weigh equal, divide remaining 20 into 8-8-4.
Weigh 8-8(WEIGH 2). After this its a 8 ball problem solved in 2 weighs. So TOTAL=4 WEIGHS.
3. ELSE
Divide 30 into 10-10-10 and weigh 10-10(WEIGH 2). Now out of 10 we need to find.
Divide 10 into 4-4-2. Out Of 4 we ll require 2 more weighs. TOTAL = 4 WEIGHS.

- Anonymous May 05, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

How to find a general solution to these kind of question? How to divide this set of balls? Is there any finer method?

- Psycho September 04, 2012 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More