# Cheating Husband Puzzle || Microsoft Interview Puzzle

Puzzle Details ...

A certain town comprises 100 married couples. Everyone in the town lives by the following rule: If a husband cheats on his wife, the husband is executed as soon as his wife finds out about him. All the women in the town only gossip about the husbands of other women. No woman ever tells another woman if her husband is cheating on her.  So every woman in the town knows about all the cheating husbands in the town except her own. Husbands always remain silent. One day, the mayor of the town announces to the whole town that there is at least 1 cheating husband in the town. What do you think happens?

let's simplify the puzzle

A certain town has 100 married couples (husband and wife only). Everyone in the town lives by the following rule:

• If a husband cheats on his wife, the husband is executed (killed) as soon as his wife gets finds out about him (He may enjoy only as long as his wife does not get to know about it).
• All the women in the town only gossip about the husbands of other women but no woman ever tells another woman if her husband is cheating on her. ( So every woman in the town knows about all the cheating husbands in the town except her own).
• Husbands always remain silent.

One day, the mayor of the town announces to the whole town that "there is at least 1 cheating husband in the town". What do you think happens?

Let’s solve this methodically. Say there was only 1 cheating husband in the town. There will be 99 women who know exactly who the cheater is. The 1 remaining woman, who is being cheated on, would have assumed there are no cheaters. But now that the mayor has confirmed that there is at least one cheater, she realizes that her own husband must be cheating on her. So her husband gets executed on the day of the announcement.

Now let’s assume there are 2 cheaters in the town. There will be 98 women in the town who know who the 2 cheaters are. The 2 wives, who are being cheated on, would think that there is only 1 cheater in the town.  Since neither of these 2 women knows that their husbands are cheaters, they both do not report their husbands on the day of the announcement. The next day, when the 2 women see that no husband was executed, they realize that there could only be one explanation – both their husbands are cheaters. Thus, on the second day, 2 husbands are executed.

Through induction, it can be proved that when this logic is applied to cheating husbands, they all die on an nth day after the mayor’s announcement.

Let’s start methodologically and consider cases:

If there is only 1 cheating husband

99 women know who is cheating. Only 1 woman (wife of the cheater) does not know of anyone cheating. The wife of the cheater must be thinking that none of the husbands cheat. After the announcement, she will realize that her own husband is cheating (if anyone else is cheating, then she must have been aware of it).

So the cheating husband will die on the first day (same day).

If there are 2 cheating husbands

Wives of both the cheating husbands think that there is only one cheating husband (i.e the other one) and hence will expect the other husband to die on the first day. When no one dies on the first day, then on the 2’nd day both of them will realize that their husband is also cheating (along with the other one).

Hence, both the cheating husbands die on the 2’nd day.

If there are n cheating husbands.

Going by the above logic, All the n cheating husbands will die on an nth day.