## Microsoft Interview Question for SDETs

Country: United States

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

I have no idea what this question is, can you provide more details on the question?

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

Actually I found the problem statement which I believe is the same problem asked here:

``````8 ball problem. if given 8 balls with only one ball being a
lighter weight and all other 7 being the same weight and
given a scale, how will you find the light weight ball. do
this in minimum number of steps``````

My initial thought is to divide an conquer which gives

``log(N)/log(2)``

so in case of 8-ball, it would be

``log(8)/log(2) = 3 steps``

, but you mentioned it can be done in two steps.

The above would be true depending on the meaning of 'scale'.

- If scale allows you to weigh one group at a time( ex Think of weighing yourself on scale, only one person at a time makes sense ), then I believe

``log(8)/log(2)``

would be true.

- If scale allows you to weight two group at a time( another type of scale ) then (after cheating and reading answer (see /question?id=8119690) ) they mention the answer is

``ceil(log(N)/log(3))``

But its only that because they skip the last ball weigh-in using slick process of elimination. So technically they don't weight all the balls.

While this problem is interesting, I'm not a fan of it, especially for a programming interview position( assuming ).

Best.

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

*cough *cough * I hate this site broken functionalities *cough *cough

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

``````public int getHeavy(List<Integer> balls)
{
return (int)Math.ceil(Math.log(balls.size())/Math.log(3));
{``````

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.

### 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.