Navigation Links

Responsive Topnav Example

Resize the browser window to see how it works.

Tuesday, March 29, 2016

Handshake Problem

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 answer is 12 persons.

No comments:

Post a Comment