Puzzle | Handshakes

A couple invites n – 1 other couples to dinner. Once everyone arrives, each person shakes hands with everyone he doesnâ€™t know. Then, the host asks everyone how many hands they shook and each person replies with a different number. Assuming that everyone knows his or her own spouse, how many hands did the hostess shake?

Solution:
N – 1, where N is the total no. of couples at the dinner.
Explanation:

• The possible numbers of handshakes range from 0 to 2N-2. (2N-1 would require that a person shook hands with every other person at the party, but nobody shook hands with his/her spouse.)
There are 2N-1 different numbers, and the host got 2N-1 different answers, so every number is represented.
• One person (0) shook no hands, and another (2N-2) shook hands with everybody from all the other couples. This is only possible if these two are a married couple, because otherwise 2N-2 would have had to have shaken 0â€™s hand.
• One person (1) shook only 2N-2â€™s hand, and another (2N-3) shook hands with everybody from all the other couples except 0. Again, these two must be married, or else 2N-3 would have had to have shaken 1â€™s hand, a contradiction.
• Continuing this logic, eventually you pair up all the couples besides the hosts, each one pairing a shook-no-hands-not-already-mentioned person with a shook-all-hands-not-already-mentioned person, the last having shaken N-2 and N hands respectively.
• This tells that the hostess must have shaken N-1 hands, since there are N-1 shook-no-other-hands people and N-1 shook-all-other-hands people. Both the host and hostess shook hands with exactly one member of each couple â€“ the same ones â€“ and thus each shook N-1 peopleâ€™s hands

Example:
N = 6

• 5 couples are invited to the dinner. Among the total six couples, no one shook more than 10 hands.
• Therefore, if eleven people each shake a different number of hands, the numbers must be 0, 1, 2, …, and 10.
• The person who shook 10 hands has to be married to the person who shook 0 hands (otherwise that person could have shaken only ten hands).
• Similarly, the person who shook nine hands is bound to be married to the person who shook 1 hand.
• Continuing the logic, couples shook hands in pairs as mentioned 10/0, 9/1, 8/2, 7/3, 6/4. The only person left who shook hands with 5 is the hostess.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Previous
Next