top of page
Search

Puzzle #29: Average Salary of 4 Employees Puzzle | Infosys



How can four employees calculate the average of their salaries without knowing other’s salary?



Puzzle Solution:

This solution has a limitation that information is partially passed and there needs some trust level.

Salary of A: i

Salary of B: j

Salary of C: k

Salary of D: l


A passes to B (i + a) where a is a number that A knows B takes this a passes to C (i + j + a + b). C takes this and passes to D (i + j + k + a + b + c). D takes this and passes to A (i + j + k + l + a + b + c + d)

Now one after another they remove their constants.

Example: A now passes to B: i + j + k + l + b + c + d (He has removed a)

B passes to C after removing his constant (b).

Thus Finally D gets x + y + z + u + d. He takes away his constant and now he has i + j + k + l.

So, the average is: (i + j + k + l) / 4.


Let us know if you know any other solution.


37 views
bottom of page