Given a sorted list of numbers in which all elements appear twice except one element that appears only once, find the number that appears only once.
1, 1, 2, 3, 3, 4, 4
Here, ā2ā appears once and all other elements appear twice.
findNonRepeatingElement([1, 1, 2, 3, 3, 4, 4]) => 2
Expected Time Complexity: O(log n)
The first line contains 'T', denoting the no. of test cases.
Each test case consists of two lines. The first contains a number 'n' denoting the number of elements. The second line has ānā space-separated numbers denoting the elements.
For each test case, a line containing the non-repeating number.
3
1
3
3
1 2 2
5
3 3 4 4 5
3
1
5
1 <= T <= 100
1 <= Size of array <= 20000
1 <= Elements in array <= 106