**Problem:**

At a party, everyone shook hands with everybody else. There were 66 handshakes. How many people were at the party?

This question is asked in Infosys written.

**Solution:**

Lets say there are n persons

1st person shakes hand with everyone else: n-1 times(n-1 persons)

2nd person shakes hand with everyone else(not with 1st as its already done): n-2 times

3rd person shakes hands with remaining persons: n-3So total handshakes will be = (n-1) + (n-2) + (n-3) +…… 0

= (n-1)*(n-1+1)/2 = (n-1)*n/2 = 66

= n^2 -n = 132

=(n-12)(n+11) = 0;

= n = 12 OR n =-11

-11 is ruled out so the

1st person shakes hand with everyone else: n-1 times(n-1 persons)

2nd person shakes hand with everyone else(not with 1st as its already done): n-2 times

3rd person shakes hands with remaining persons: n-3So total handshakes will be = (n-1) + (n-2) + (n-3) +…… 0

= (n-1)*(n-1+1)/2 = (n-1)*n/2 = 66

= n^2 -n = 132

=(n-12)(n+11) = 0;

= n = 12 OR n =-11

-11 is ruled out so the

**answer is 12 persons**.
12C2

Nice question,

Easier to think about it if you just use a small number example; say, 3 people A, B, C, D

Handshakes:

A-B, A-C, A-D [lot 1]

B-C, B-D [lot 2]

C-D [lot 3]

So 6 in total, which is 3 + 2 + 1 (3 lots of handshakes if you group them per person).

There are 4 people in this example as’D’ does not have a specified lot of handshakes since D’s handshakes would be counted within the others’ lots

so to do it manually for 66:

1 + 2 + 3 + 4…+11 = 66

So 11 is the number of handshake lots going by person

Then add 1 for the 12th person who has their handshakes within the other 11 people’s lots