Technical Interview

Tips, questions, answers and puzzles at
www.technical-interview.com

Thursday, February 8, 2007

Every man in a village of 100 married

Every man in a village of 100 married couples has cheated on his wife. Every wife in the village instantly knows when a man other than her husband has cheated, but does not know when her own husband has. The village has a law that does not allow for adultery. Any wife who can prove that her husband is unfaithful must kill him that very day. The women of the village would never disobey this law. One day, the queen of the village visits and annoces that at least one husband has benn unfaithful. What happens?

18 comments:

  1. Nothing happens. The queen does not tell the wives anything they don’t already know. They know that the other husbands are cheating, so it is not new news to them.

    ReplyDelete
  2. Since the queen says that "at least one" husband has been unfaitfull, and each woman knows that 99 husbands have been unfaitfull, if each woman tells the others the names she knows, they will easily discover all 100 men. All men will be executed.

    ReplyDelete
  3. Both above are wrong.
    This question will be solved with recursion.
    Lets say there is only one couple, on the same day wife kills the man.
    if there are 2 couples, on second day, both the wives kill the men. Because, on the first day each wife waited for the other man to get killed but it did not happen.

    ReplyDelete
  4. After 99 days, all men will be executed.

    ReplyDelete
  5. slightly changing the last answer, I believe every husband gets killed on the second day itself. cause the first day every wife waits for one of the 99 to kill their husband.. when nobody does, she kills her husband.. that way every husband dies the second day.. and god kills the queen for the massacre..

    ReplyDelete
  6. The queen has to speak to let know that every woman know that every woman know at least one man has cheated.
    and then i agree with the solution above

    ReplyDelete
  7. The queen's statement is not a surprise for the ladies of the town , except one lady. As all the ladies know when there is an adultery except the wife of the man involved. The lady who did not know that there adultry , now knows that , it is her husband is involved, and she will kill her husband.

    ReplyDelete
  8. It would always be O(2). If every woman knows all of the husbands that cheated besides their own, then the first woman will be able to tell on all of the husbands besides hers. Now we would just need one person to verify whether her (the initial lady telling on the husbands) husband cheated or not.

    ReplyDelete
  9. I think as the queen said "there is at least one ", then there are 2 possibilities -


    1. There is only one cheat husband
    - If it is so then 99 wives knew it before. So the cheated wife got the idea from queen that her husband is cheating. So she will kill him. Next morning every wife will know there is no cheat husbands anymore.


    2. There are more than one cheat husbands

    - In this case, all of the wives already had the idea prior to queen's information. Its just that the cheated wives knew the count which is one less than what the non-cheated wives' knew - thats all. i.e. if there were 2 cheat husbands then their wives knew the count is 1 and others knew its 2. So the queen just repeated the info saying "at least 1". Same goes to 2,3,4...100 cheat husbands. So in this case no wife kills her husband.

    ReplyDelete
  10. I partially agree with dead rabbit but here is what I think:
    Assuming that the wives believe the village queen:

    1. If all the husbands were not cheating and the queen was saying a wrong statement, All the men will be executed!. Because All the wives will consider their men as the cheating husband.

    2. If there is only 1 cheating husband, his wife will know and he will be the only husband being executed.

    3. If more than 1 husband is cheating, no wife will be able to tell that her own husband is cheating so, no man will be executed.

    ReplyDelete
  11. If the queen didnt knew until that day ,that at least one husband cheating his wife, then this means that no husband(witout king) cheating his wife until one day before that day .
    Because all men was a cheater , that means that all men cheating their wifes with queen the day before that day.
    All the men are executed.

    ReplyDelete
  12. here are the things you know:
    100 total couples
    every man has cheated on his wife.
    wife can know if the other husbands have cheated but not about her own
    wife knows that there's atleast one cheater. (helpfull for creating logic but pointless since she can see 99)
    wife must kill HER husband they day she finds out he cheated.

    using hte same rules but in a village with one couple; the wife sees no one cheating and doesn't know about her own. she does know that atleast one is cheating and so it has to be her husband and he dies.


    using hte same rules but in a village with two couples; the first wife sees the second husband cheating and the second wife sees the first husband cheating. each of the wives are unsure about their husbands. they know that ATLEAST one is the cheater. but no one dies as they dont know about their own. on day 2, wife 1 sees that husband 2 is still alive. she knows that this can only be so if wife 2 also saw the same thing which is seeing the other husband as guilty. she wont kill her husband because she saw another guilty and isn't sure about her own which is the same reason wife 1 didn't kill her own on day 1. if wife2 had seen the other husband 1 as innocent she would know that her husband 2 has to be the guitly one (since there is ATLEAST one guilty and if hte other one is innocent yours has to be guilty.) by that logic, wife 1 knows that wife 2 had seen husband 1 as guitly and kills him. wife 2 uses the same logic and kills her husband also.

    using hte same rules but in a village with three couples; the third wife sees husband 2 and husband 3 as guilty. the other wives do the same. on day one you have to assume your husband is innocent and not kill him becasue you are unsure, you know there are two but there can be more. on day 2 if your husband is innocent wife 1 and 2 would ahve killed someone because they can see that yours is faithful and then deduce that their own husbands is a cheater. (if they see wife3's husband as innocent they can illiminate him and use the logic from village with 2 couples) but doesn't happen on day 2 because all the wives thought hte same thing. on day 3 you know that your husband is also a cheater and kill them, and the individual wives do the same since they see things from the same yet individual perspective.

    now apply this same logic to the a village with 4 couples, then 5 then 50 then 100;

    ReplyDelete
  13. This is my thinking, assuming that the women are aware that they cannot tell if their husband has cheated:

    All of the women know everyone else's husbands are cheaters and have never said anything as they know the consequence is death. They also know a sure way of finding out if their husband has cheated is by outing someone else's so an unspoken truce develops.

    When the queen (whose husband, based on the premise, is also cheating) breaks that understood code of silence, she then has to out the cheater as by law they cannot ignore a proven cheater and must kill him. This upsets the uneasy balance and the accused husband's wife kills him, but also accuses the queen's husband of cheating in return and the Queen then has to kill the King as well (which would have had to have been the queen's intention as she violated the unspoken rule and upset an uneasy truce that heretofore existed). All of the other wives stay silent and life goes on as it was before. So two husbands are killed....as a result of a power play by the Queen presumably.

    ReplyDelete
  14. Missing information: Time that it takes for an innocent man to cheat. Do they all cheat every night or only every fortnight? In a three person village it would require a fortnight to see an innocent man cheat. Two women's view would then change to the third woman's view of two cheaters in 14 days. The other two would kill their husbands at that point, but since there is no killing they would all kill their husbands, only if the women knew of the cheating periodicity.
    So does every man cheat every night? It is unclear from the story, but would allow for a solution.

    ReplyDelete
  15. well...I think nobody will die.. lets look at this scenario carefully... the village has only 100 married couples, means no unmarried women there.. so if husband has to cheat, he has to cheat with other women. and all the other except mans wife will come to know, so, if every man selects a different wife, then all the women also have cheated on their husband and will not reveal others, because they will reveal their name which would lead to their death. so they maintain silence

    ReplyDelete
  16. The husbands have to cheat with the other women in the village so the women will know which men have cheated and will simply have to come forward when the queen asks if they do legitimately want to follow the law.

    ReplyDelete
  17. @Ali El Gamal :::First two cases are OK.If more than 1 husband cheats say 3,then apart from their wives every other wives knows 3 as the number .Since every woman is aware about what the queen said , they just kill their husbands on the second day because on the first day no killing happens as they are all waiting for it.

    ReplyDelete
  18. AnonymousApr 16, 2009 02:08 AM
    here are the things you know:
    100 total couples.....

    mindblowing.. great yr.. thats correct solution.. so on 100th day every wife will kill her husband.. :)

    ReplyDelete