Minimum number to form the sum even
Submissions: 4241   Accuracy:

37.97%

  Difficulty: Basic   Marks: 1

Given an array, write a program to add the minimum number(should be greater than 0) to the array so that the sum of array becomes even

Input:
The first line of input contains an integer T denoting the number of test cases. The first and last line of each test case consists of an integer n. Next line of each test case cinsists of n spaced integers.

Output:
Print the minimum number required to the array so that the sum becomes even .

Constraints: 
1<=T<=100
1<=n<=1000
1<=a[i]<=100000

Example:
Input:

2
8
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8 9

Output:
2
1

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Ashtputre
Author: saksham0751


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.