Problem #39 EASY

The Handshake Count

Google Meta Combinatorics Logic

Problem Statement

At a small networking event, every person in the room shakes hands exactly once with every other person. By the end of the evening, a total of 28 handshakes have taken place. How many people attended the event? Now generalise: if there were n people, how many total handshakes occur?

Answer & Quick Explanation

Think you've got it? Click below to check your answer.

8 people attended. General formula: n(n-1)/2 total handshakes for n people. For n=8: 8 x 7 / 2 = 28. The formula counts the number of unique pairs, since each handshake is shared between exactly 2 people.

Detailed Editorial Solution

Want to see the step-by-step breakdown? Click below to reveal the editorial.

Model each handshake as an edge in a complete graph where each person is a node. The number of edges in a complete graph with n nodes is C(n, 2) — the number of ways to choose 2 nodes from n. Step 1: Label each person as a node. A handshake between two people is an edge connecting their nodes. Step 2: Every person shakes hands with every other person exactly once, so the graph is complete — every pair of nodes is connected. Step 3: Number of edges in a complete graph = C(n, 2) = n! / (2! x (n-2)!) = n(n-1) / 2. Step 4: Set up the equation: n(n-1)/2 = 28. Multiply both sides by 2: n(n-1) = 56. Step 5: Try small integers: n=7 gives 42 (too small). n=8 gives 8 x 7 = 56. Correct. Step 6: Answer: 8 people attended. General formula: with n people, total handshakes = n(n-1)/2. Key Insight: Viewing the problem as a graph instantly converts it into a formula. The complete graph K_n has exactly n(n-1)/2 edges — this is one of the most useful counting identities in combinatorics and appears across interview problems involving pairs, comparisons, and connections.