Problem of the day
For ‘N’ = 7 and ‘Arr’ = {1, 1, 2, 3, 3, 4, 4}.
1, 3, and 4 occur exactly twice. 2 occurs exactly once.
Hence the answer is 2.
The first line contains an integer ‘N’, representing the size of the array ‘Arr’.
The second line contains ‘N’ integers, denoting the elements of the array ‘Arr’.
Return an integer, equal to the integer in the array that occurs exactly once.
1 <= N <= 10^4
1 <= Arr[i] <= 10^9
‘N’ is always odd.
Time Limit: 1 sec
5
1 1 2 2 3
3
{1, 2} each occurs twice, whereas, 3 occurs only once.
Hence the answer is 3.
5
8 8 9 9 10
10