Find the unpaired message with XOR
A gateway logs every order message twice (send and echo), so each message id should appear exactly twice in the log. One id appears only once, its echo was dropped.
ids = [4, 1, 2, 1, 2]
-> 4
Find the unpaired id in time and space. A hash set works but costs memory, the interviewer wants the bit trick.
Show a hint
What is ? What is ? Is order-sensitive?
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.