values every number appears exactly twice, except two different numbers that appear once each. Return those two numbers in any order.
With a set or a dictionary this is easy. Try for linear time and O(1) extra memory.values=[6, 3, 8, 6, 3, -2] → [-2, 8]
6 and 3 come in pairs, leaving 8 and -2 alone. [8, -2] is also accepted.
values=[10, 11] → [11, 10]
There are no pairs at all, so both numbers are single.
values=[6, 3, 8, 6, 3, -2]
[-2, 8]
Run checks the first 3 tests in your browser. Submit checks all 62 tests on the server, hidden ones included.