#C1672. Find the Single Number
Find the Single Number
Find the Single Number
You are given an array of integers in which every element appears exactly twice except for one element that appears only once. Your task is to identify that unique element. This problem can be efficiently solved using the properties of the bitwise XOR operation: [ a \oplus a = 0 \quad \text{and} \quad a \oplus 0 = a ] By XOR-ing all the numbers together, the duplicate numbers will cancel out, leaving only the unique number. The solution should run in linear time and use constant extra space.
inputFormat
The input is read from standard input (stdin). The first line contains an integer (n) — the number of elements in the array. The second line contains (n) space-separated integers representing the array.
outputFormat
Print to standard output (stdout) the unique integer that appears only once in the array.## sample
7
4 3 2 4 1 3 2
1
</p>