You are given an array of n integers, where n is odd. Every value occurs exactly twice, except for one value that occurs exactly once. Find that value. Aim for O(n) time and O(1) extra memory.
The first line has n. The second line has the n integers.
Print the value that occurs once.
1 <= n <= 199999, n is odd |a_i| <= 10^9 Exactly one value occurs once and all the others occur exactly twice.
1000 ms256 MB
5 4 1 2 1 2
4
The values 1 and 2 each appear twice.
1 7
7
A single value is the lonely one.