Microsoft
Company
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?
Read Solution (Total 4)
-
- please give explanation to ur solution....
- 12 years agoHelpfull: Yes(10) No(1)
- The cheating husband problem is a classic recursion pb.
Once all the wives know there are at least 1 cheating husband, we can understand the process recursively. Let's assume that there is only 1 cheating husband. Then his wife doesn't see anybody cheating, so she knows he cheats, and she will kill him that very day. If there are 2 cheating husband, their wives know of one cheating husband, and must wait one day before concluding that their own husbands cheat (since no husband got killed the day of the announcement).
So with 100 cheating husbands, all life is good until 99 days later, when the 100 wives wives kill their unfaithful husband all on the same day.
- 11 years agoHelpfull: Yes(8) No(0)
- All 100 husbands are killed by wives on 100th day.
- 13 years agoHelpfull: Yes(2) No(19)
- if no of husband cheated = n
than a wife who's husband is not cheating will have know number n
and a wife who's husband is cheating will have known no of others husbands is n-1,
so queen would ask for the womens who has less known number and kill their husbands,
done - 8 years agoHelpfull: Yes(0) No(0)
Microsoft Other Question