Objective
The XOR operator satisfies a ^ a == 0 and a ^ 0 == a. If you XOR all the numbers, those that appear twice cancel out and the one left alone remains, with no dictionaries and no sorting.
Instructions
- The input is a line with integers separated by spaces. All of them appear twice except one.
- Show the integer that appears only once.
4 1 2 1 2
4
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise