Friday, April 24, 2015

HackerRank::Algorithms::Combinatorics::Handshake

  The first man shakes hands with 2,3...N, total N-1 handshakes, the second man shakes hands with 3,4..,...N total N-2 handshakes, and so on until the N-1 the one shakes hands with only N th one, we have total handshakes equal to 1+2+3+...+N-1 which equals to  ((N-1)* (N))/2


No comments:

Post a Comment