Puzzle 26 | (Know Average Salary without Disclosing Individual Salaries)
Three Employees want to know average of their salaries. They are not allowed to share their individual salaries.
Answer:
1) X adds a random number to his salary and tells the sum to Y.
2) Y also adds a random number to sum told by X and tells new sum to Z.
3) Z also adds a random number to sum told by Y and tells new sum to X.
4) X subtracts its random number from sum told by Z and tells the new number to Y.
5) Y subtracts its random number from sum told by X and tells the new number to Z.
6) Z subtracts its random number from sum told by Y and announces the new number.
The new number is now sum of three salaries and average can be calculated by dividing the sum by 3.
Finally, nobody knows salary of others, but all know average.
This can be extended to more than 3 employees also.
This article is contributed by Shivam. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Recommended Posts:
- Puzzle 1 | (How to Measure 45 minutes using two identical wires?)
- Puzzle 2 | (Find ages of daughters)
- Puzzle 3 | (Calculate total distance travelled by bee)
- Puzzle 4 | (Pay an employee using a 7 units gold rod?)
- Puzzle 13 | (100 Prisoners with Red/Black Hats)
- Puzzle 5 | (Finding the poisoned wine)
- Puzzle 6 | (Monty Hall problem)
- Puzzle 7 | (3 Bulbs and 3 Switches)
- Puzzle 8 | (Find the Jar with contaminated pills)
- Puzzle 9 | (Find the fastest 3 horses)
- Puzzle 10 | (A Man with Medical Condition and 2 Pills)
- Puzzle 11 | (1000 Coins and 10 Bags)
- Puzzle 12 | (Maximize probability of White Ball)
- Puzzle 14 | (Strategy for a 2 Player Coin Game)
- Puzzle 15 | (Camel and Banana Puzzle)