Bloomberg LP Interview Question for Software Engineer / Developers






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

1st person starts the process by taking up any random number.
he adds his salary to this number and passes it to 2nd.
2nd adds his salary to this figure and passes it to 3rd
3rd adds his salary to this figure and passes it to 1st

1st subtracts the random number he had selected and then gets the total sum of all their salaries.... and gets the average.

- VineetG November 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

No ... the 1st guy can subtract his random # and his own and the others salaries off successively, and know them all. Good idea though, the random #.

- jd January 12, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

my soln invovles two rounds,


in first round, everyone add a random percentage of their salaries.
in the second round, they add the rest. I think if you add a couple of rand numbers during these round, these thing should be stable enough.

- Rishi October 16, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1st person starts the process by taking up any random number.
he adds his salary to this number and passes it to 2nd.
2nd adds his salary to this figure and passes it to 3rd
3rd adds his salary to this figure and passes it to 1st

1st subtracts the random number he had selected and then gets the total sum of all their salaries.... and gets the average.

- VineetG November 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

When 2nd adds his salary and passes it to the 3rd one everyone knows his salary and the same with the 3rd one.

So at each step everyone adds his salary and a random number and the same thing happens and after one circle every one subtract their random number and in the end they get total salary sum and the average.

- JoshMachine November 22, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

No, consider salaries (100,110,91)
1st one adds random number to his salary, 12345 + 100 -> 12445
2nd one doesn't know the random number and adds his salary, 12555
third one also adds his salary -> 12646
Now 1st one subtracts random number -> 12646 - 12345 = 301
average = 301/3 = 101.333

- A no NY mouse November 22, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

If they are saying it out loud so everyone in the table hears once the 2nd one adds his salary and says the new number first guy will know 2nd guy's salary immediately. If they are whispering to each other's ears than you would be right.

- Rayden November 22, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

no one's whispering..nothing.
process 1 adds a random number 'x' and passes the token to process 2,
process 2 adds its value and passes to process3.
process3 adds its value and passes to process1
process1 subtracts x from total and divides by 3.

- SamOnYoun November 22, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

A more clear rundown...

First guy says: Rand + salary1
Second guy says: Rand + salary1 + salary2

At this point first guy already know the random number and his salary. Now he can find the second guy's salary easily.

Third guy says: Rand + salary1 + salary2 + salary3
Now the first guy know everyone's salary and second guy knows third guy's salary.

Josh's solution won't work as well unless you assume that they forget the past numbers they heard. When the first guy subtracts his random number the 2nd guy will know his random number. He already knows salary1 + random number so now he knows first guy's salary.

- Rayden November 23, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

my solution will give an approximate solution. ask each person to give a range of their salaries (lower limit, upper limit) where upper limit-lower limit = constant for all persons and the exact salary should not be the average of the two limits.
suppose the values are (x1,y1),(x2,y2)and (x3,y3) where y1-x1= y2-x2= y3-x3= d (say).

step 1: find Xmin = min (x1,x2,x3) and Ymax = max (y1,y2,y3).
step 2: find P = (Xmin+Ymax)/2
step 3: find q1 = (x1+y1)/2, q2 =(x2+y2)/2, q3 =(x3+y3)/2
step 4: find Q1 = min(q1,q2,q3), Q2= max(q1,q2,q3), Q =(Q1+Q2)/2
step 5: find A = (P+Q)/2

The solution will be fairly accurate for small values of d.

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

This is a simple application public key cryptography. Try out.

- Anonymous November 23, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Public key cryptography ..is not matched for this concept.. if u can justify using public key...plz let all know.. thanks

- rkris November 24, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

why not take this algo..
process 1 adds a random number 'x' and passes the token to process 2,
process 2 adds its value and a random number 'y' and passes to process3.
process3 adds its value and passes to process1
process1 subtracts x from total and gives to process2.
process2 subtracts y from total and divides by 3.
:)...no one knows what others salaries are...

- Anonymous November 23, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

If you are assuming that they are whispering to each other (3rd person doesn't hear) just the first person using the random number is enough. The other 2 random numbers are unnecessary.

- Rayden November 24, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

to prevent person 1 from knowing person 2's salary, i think y would be necessary, because otherwise when person 2 announces x + salary1 + salary2, person 1 can just subtract the figure he said ( x + salary1) to find person 2's salary...

- angie February 02, 2012 | Flag


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