Fog Creek Software
Discussion Board




Flaw in proposed salaries puzzle solution

With reference to the solution proposed by scott cooper on techinterview.org.

At the end of the process, B knows.
BS : His own salary
BR : The random number he used
AS + AR : A's salary + A's randum number
AS + BS + BR + CS + CR : The total after A's subtracted his random number.
(AS+BS+CS)/3 : The average salary

Now he can deduce as follows:
(AS+BS+CS)/3*3 = AS+BS+CS
AS + BS + BR + CS + CR - AS+BS+CS = BR + CR
BR + CR - BR = CR
Which he can then use to determine the rest of the unknowns.

Here is an alternative solution.
Agree on a physical representation of an amount, say one match represents 10K, A, B and C all dump there matches into a bag, the contents is counted and divided by three.

Kees Snijders
Monday, April 14, 2003

I have to respectfully disagree.  Determining CR doesn't help B to determine anything else.  All he/she has now is:
BS, BR, (AS + AR), (AS + CS).

Let's say that AS + AR = a and AS + CS = b.  How you can derive values of 3 unknowns from just 2 equations?

Mark Gershaft
Wednesday, May 07, 2003

B also knows AS+BS+CS+BR+CR. Which can give AS+CS+CR, from which he can get CR. Once he get CR, he can get AR, AS, and CS.

nagasatish
Friday, May 16, 2003

How does he get AR after getting CR ?

indian programmer
Thursday, June 19, 2003

*  Recent Topics

*  Fog Creek Home