#C8957. Find the Single Number
Find the Single Number
Find the Single Number
Given a list of integers where every element appears exactly twice except for one, your task is to find the unique integer that appears only once. This problem can be efficiently solved using the bitwise XOR operator.
The XOR of two same numbers is 0 and the XOR of a number with 0 is the number itself. Thus, by XORing all numbers, the repeated numbers cancel out, leaving the unique number as the result.
Note: Read the input from standard input (stdin) and print the result to standard output (stdout).
inputFormat
The input consists of two lines:
- The first line contains an integer N representing the number of elements in the array.
- The second line contains N space-separated integers.
outputFormat
Output a single integer, which is the unique number in the array.
## sample7
2 3 5 4 5 3 4
2