There are N people in a room. If two persons shake hands exactly once, find the maximum number of handshakes possible. 
 
Example 1:
Input: N = 2
Output: 1
Explaination: There are two people and they 
can shake hands maximum one time.
 
Example 2:
Input: N = 3
Output: 3
Explaination: Let the people be person 1, 2 and 3. 
So the possible handshakes are (1, 2), (2, 3) and 
(1, 3).
 
Your Task:
You do not need to read input or print anything. Your task is to complete the function handShakes() which takes N as input parameter and returns the maximum number of handshakes possible.
 
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
 
Constraints:
2 ≤ N ≤ 10^{9}

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3



class Solution:

    def handShakes(self, N):

        # code here

Solutions:
class Solution:

	def handShakes(self, N):
		return N * (N - 1) // 2


class Solution:

	def handShakes(self, n):
		return n * (n - 1) // 2


class Solution:

	def handShakes(self, n):
		if n == 0:
			return 0
		else:
			return n * (n - 1) // 2
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.handShakes(N))