BETA
This is a school problem. Successful submissions of this are not counted in user ratings.

Submissions : 1888 Accuracy :

37.08

Find duplicates under given constraints
     

Given a sorted array having 10 elements which contains 6 different numbers in which only 1 number is repeated five times. Your task is to find the duplicate number using two comparisons only.

Examples:

Input: A[] = {1, 1, 1, 1, 1, 5, 7, 10, 20, 30}
Output: 1

Input: A[] = {1, 2, 3, 3, 3, 3, 3, 5, 9, 10}
Output: 3


Input:
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow . Each test case contains 10 space separated values of the array A[].

Output:
For each test case in a new line print the required duplicate element.

Constraints:
1<=T<=100
1<=A[]<=10^5+5

Example:
Input:

2
1 2 4 5 6 9 9 9 9 9
1 2 3 3 3 3 3 5 9 10

Output:
9
3

**For More Examples Use Expected Output**


Set Default Code

					   
Result:
It is recommended to test your code before clicking 'Submit' button!



                   



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