Bloomberg LP Interview Question for Java Developers

Country: United States
Interview Type: In-Person

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

Step 1. 5 people can sit around a circular table in 4! ways
Step2. Consider these two poeple as one unit so 3 people + 1 Couple can sit around a round table in 3! ways
Step3. But the couple can exchange seats in 2 ways. MH or HM
So the total probability is 2. 3! / 4! = 1/2 = 50% chance

Comment hidden because of low score. Click to expand.
2

You just verified that my answer was correct. I as thinking a little bit differently. No matter where one of these two people sits (say person A) the second one (B) has 4 choices, where 2 out of theses 4 choices are next to A, so probability is 2/4 = 1/2=50% chance.

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

I know there are various ways to think about this but a systematic approach solves big confusion :) ..

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

Following your advise for a systematic approach this could be thought of a little bit differently and of course giving the same result. As before person A takes any sit, there are 4! arrangements for B,C,D and E. Considering only arrangements where person B sits next to A, out of all these arrangements we are interested only in those that either start with B (=3!) or end with B (=3!), so the probability of A and B sitting next to each other is (2*3!)/4!=1/2 = 50%. This is basically the same as hello world did before without combining A and B in one unit but counting through separately.

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

If we have n people then the probability is 2/n-1.
Below is the proof:-
no of ways n people are sitting around a table is (n-1) ! while probability that now taking both people who should be sitting together as 1 unit we have n-1 people so no of ways now is (n-2)! .Also for each of (n-2)! ways both of them have two choices so total no of ways in which two people who always sit together can be arranged around the table with other n-2 memeber is 2*(n-2)!. Thus probability is (2*(n-2)!)/(n-1)! which comes down to 2/n-1. Putting n=5 we get 1/2 etc.

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

2/4 = 50%

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

Imagine that you are sitting in some random seat of the circular table. Now you have four other people A,B,C,D.
Any X person out of the four will be 'sitting next to you' if he sits to your immediate left or immediate right.

Now X has to choose from four seats. So X choosing an adjacent seat has a probability of 2/4 which is 0.5

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

For N people there are (N-1)! different orders of sitting around the table.
It is easy to explain.
First person sits elsewhere. There are N-1 persons who can sit to his/her right, N-2 to the right of the second etc., so we have: (N-1)(N-2)...2 = (N-1)!

For 5 people there are 4! = 24 ways to sit. If A and B neighbours, they can be AB or BA so 2 ways to sit. Consider AB (or BA) as just one person. Then in total there are 4 and (4-1)! = 6 ways to sit. So there are 6 ways to sit for AB and 6 for BA, in total 12.

So 12 ways to sit when they are neighbours and 24 ways to sit in total, so P (A & B neighbours) = 12/24 = 1/2.

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

Probably the simplest explanation is this:

Pr(1st) = 5/5 = 1 since whomever is first can sit wherever he wants.

Pr(2nd) = 2/4 = 1/2. This is because there are 4 seats remaining, two of which the 2nd person can sit at in order to be next to the first.

Now we have 3 remaining seats and these guys can sit in any order. So the respective probabilities are 3/3, 2/2, 1/1, which all equal 1.

Then the final answer is 5/5 * 2/4 * 3/3 * 2/2 * 1/1 = 2/4 = 1/2

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

Suppose the 5 seats are numbered thus different than each other.

Total # of possible ways to sit = 5 !
# of possible ways to sit when two people are together = 10 (10 ways to arrange the two peopl) x 3!

Probability = (10 x 3 !)/5! = 1/2 = 50%

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

This question proves that many developers can't see the wood for the trees.
Honorable exceptions for memo, CreepyMan and others !

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

what is the probability of sitting six students in round table if no two spesific students sit togther

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

I really don't understand any of the solutions above.
Isn't the solution a function of the total number of seats N ? (which is not given by the problem)
If N increases, the solution should decrease.
Everyone seems to assume that there are 5 seats, but if we randomly put 5 people in 5 seats ? Then the solution is 1. There are always two people next to each other because there are no empty chairs.

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

You are wrong - Probability that A can sit in any one of the 5 seats is 0.2 (1 in 5). Probability that B sits next to A is 0.25 (1 in 4). Probability that A sits next to B is 0.2 * 0.25 + 0.2 *0.25 (AB + BA) = 0.1

Imagine if 50% were right, then A and B sitting next to each other is 50%, C and D sitting next to each other is another 50%. That itself gets the probability to 1!!!

0.1 is the right answer - there are total of 10 different pairs with 5 people (5C2) so the probability of each pair is 0.1, total probability is 1.

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

> Probability that B sits next to A is 0.25 (1 in 4)
>Probability that A sits next to B is 0.2 * 0.25 + 0.2 *0.25 (AB + BA) = 0.1

?

Say, A sits anywhere, there are 4 spots left. 2 are adjacent, and 2 not. The likelihood, hence, that they sit next to each other is 0.5.

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

To clear the confusion - Probability of A sitting in any one seat is 0.2. Given A sits in some seat, probability of B sitting next to A is 1 in remaining 4 seats which is 0.25. If A and B are sitting next to each other, then the configuration can be AB or BA (B sits to the left of A or right of A). So the total probability of A and B sitting next to each other is (0.2 * 0.25) + (0.2 * 0.25) => AB configuration or BA configuration and hence total probability is 0.1

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

@Anonymous

I repeat @memo.

In the remaining 4 seats, 2 of them are next to A (1 at left and 1 at right ). If B sits either of these 2, then B sits next to A, so the probability becomes 2/4 = 0.5

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

``````To everyone:
I believe if you want to do well in probability then just explaining your answer is not enough, you should also learn to explain why other's answer is different from yours and may be why other's answer is wrong.

To Anonymous:
The way you've thought and got an answer 1/10 is not incorrect but there are few subtleties that you should understand.
In a circular table how we decide various arrangement of n people depends on how you model the case. There are two general approaches -  (1) One way is to consider based on who is at one's left or right and if that differs then we call it's a different arrangement,. In this case we implicitly consider all chairs/seats are equivalent. (2)The other way to call two arrangements different is even when same people are to each other's left and right but they now occupy a different seats. In this case seats are implicitly not equivalent - may be seats are numbered or colored etc.
Every one solved this question with answer 1/2 implicitly assumed 1st case of equivalent chairs/seats. Since you've assumed probability that A sits in one of the 5 seats = 1/5, I could guess that you've implicitly taking 2nd approach where chairs also got numbering (or some kind of identifications).

Important thing to note here is that even with this numbered chairs P(A takes any one of the numbered seat) = 1 and not 1/5. This is because sample space of this experiment = sample space of the event = {C1, C2, C3, C4, C5} where C1= A takes chair 1 and so on.
To match up the answer 1/5, the event should be A takes a specific seat say C1.
Thus P(A takes C1)= 1/5
Now for this specific seating by A, B got 4 options {C2,C3,C4,C5} and the sample space for the event that B seats next to A is {C2, C5}. Thus for this specific seating of A at C1, the probability that B seats next to A=2/4 (technically this is a conditional probability).
So the answer you got i.e. 0.1 matches to a question something like – what’s the probability that A sits to a specific chair and B sits next to it!

Now I guess the missing link between the approach 1 where the answer is 1/2 and the approach 2 where your answer was 1/10  is that even when you considered the chairs are different, you didn’t answer the original question – what’s the probability that A and B seat next to each other. You didn’t consider all the cases that A can sit in C2, C3 etc.
Thus using 2nd approach the correct probability is P(A takes C1 and B sits next to A) + P(A takes C2 and B sits next to A)+... = (1/10)+ (1/10) + up to 5 times = 1/2.

Now you could see that either way correct answer is 1/2.``````

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.