Loading...
Loading...
Loading...
In a list of readings, exactly two values appear once and every other value appears twice. Print the two single values, the smaller first.
Example
Input
6 1 2 1 3 2 5
Output
3 5
The values 3 and 5 appear once.
Try the problem first. Open one hint at a time.
XOR all the values: the pairs vanish and you get a ^ b, which is not 0.
A set bit in a ^ b is a bit where a and b differ. Use it to split the values into two groups, and XOR each group.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor