Search This Blog

Loading...

Flipkart Interview Puzzle

Flipkart Interview Puzzle - 3 June

You and your two friends are working in a multinational company. How can you three find out the average salary of you all without disclosing your own salary to the other two ?
For Solution : Click Here

9 comments:

  1. The first guy should add a secret random number to his salary amount and pass that sum to the second guy. He has to add his salary value to that sum and pass it to the third who will also do the same. The resulting number will have the sum of 3 salary smount plus that secret number. Finally, this result should be passed from third guy to the first who will subtract the secret number from it, divide by 3 to find average and communicate the same to the other two.

    ReplyDelete
  2. Better solution:
    First guy should add a negative number to his salary (so that the sum itself becomes negative) and pass it to second guy. To this sum, second guy should add another negative number and his own salary making sure the new sum is still negative.. and pass it to third guy. Third guy should repeat the process.
    After that, the first guy subtract that negative number (same as saying add the abs of that number) to the new sum and pass it to second guy. Second guy should repeat the process and so should third guy.
    Let the third guy divide that by 3 which is the average salary.
    -------------
    This solution is better because it doesn't even give a clue that one's salary is certainly not above the sum that they are disclosed.
    ---------------

    ReplyDelete
  3. "How can you three find out the average salary of you all without disclosing your OWN salary to the other two ?"

    Ask the other two for their salaries and get a calculator

    ReplyDelete
  4. "How can you three find out the average salary of you all without disclosing your OWN salary to the other two ?"

    Ask the other two ... and get a calculator

    ReplyDelete
  5. Let us say that the three people are A, B and C respectively. Now you, A will tell the sum of your salary and a random number to B.
    SA (Actual Salary) + A (random number of A)

    In the same manner your friend B, will add his salary with a random number to the amount given by A (you) and will pass it to C.
    (SA + A) + (SB + B)

    C will do the same.
    (SA + A) + (SB + B) + (SC + C)

    Now C will pass this total amount to A. He will subtract his random number from the amount and it will become:
    (SA) + (SB + B) + (SC + C)

    Then he will pass it to B and B will subtract his random number from the amount.
    (SA) + (SB) + (SC + C)

    Then he will pass this to C who will subtract his random number.
    (SA) + (SB) + (SC)

    Now C has the total amount of their combined salaries. He will tell the amount to all of you and you can easily divide it by 3 to get the average salary.

    ReplyDelete
  6. Ask them to write their actual salaries on a paper and randomly mix before you get it. Add it to theirs and get the average..

    Meets the conditions in the question.


    But the random number solution is more elegant

    ReplyDelete
  7. get discount coupons http://couponhaat.in

    ReplyDelete