 Bloomberg L.P.

## Interview Question

Financial Software Developer Interview

-

# three friends with different salaries need to find out their average salary without revealing individual salaries to each other. how?

3

Person A splits his salary into two unequal parts, A1+A2, choosing any split he likes. He tells B what A1 is and C what A2 is. Now B adds his own salary to A1 and tells C the total, B+A1. Then C can add B+A1 to his own salary plus A2 which he received from A, getting the sum of the three salaries, and divide by 3. No randomness needed.

Anonymous on

3

http://mindyourdecisions.com/blog/2009/04/07/game-theory-and-salary-transparency/

Anonymous on

3

The answer can simply be that the first guy adds a random number, and after going around the group the first guy himself subtracts it and gives the average. No need to add two other random numbers as stated above

Soham on

0

Ask a 3rd party to take each dudes salaries and return the average salary.

Benjamin on

0

One type of solution is to use a physical token system to record the salaries and then average the total. For example they could agree a system of 10gram of rice represents \$1000/year then each friend in turn weighs out the rice equivalent of their salary and tips it in into a communal bowl. After all three are done they just need to weigh the total amount of rice and divide by three. Alternatives would be to use pennies, water volume, etc.

Jeremy on

0

IF person A knows his salary and person B's salary only and person B knows his salary and person C's salary only and person C knows his salary and person A's salary only Person A can say "the sum of my salary and person B's salary is x" Person B can say "the sum of my salary and person C's salary is y" Person C can say "the sum of my salary and person A's salary is z" in other words, A+B=x B+C=y C+A=z the average will be (x+y+z)/6 because each salary is added twice, so you have to divide by two to counter that, and then divide by three because there are 3 people.

Anonymous on 