# Handshake Problem || Math Problem

Math interview puzzles are problems or challenges that are often used by employers as part of a job interview process to assess a candidate's problem-solving, critical thinking, and mathematical skills. Math interview puzzles are important because they provide a way for employers to assess a candidate's problem-solving and critical thinking skills, as well as their ability to apply mathematical concepts in real-world scenarios. Here is a Math Interview puzzle that is frequently asked in job interviews.

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

Solution:

Let's say there are n persons

1st person shakes hands 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 the remaining persons: n-3

So 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.

An alternate way to solve

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 handshakes lots going by person, Then add 1 for the 12th person who has their handshakes within the other 11 people’s lots.

Watch the below video for a detailed explanation.