Find the injected order id with XOR
A risk monitor keeps two logs of order ids. Log b is supposed to be a reshuffled copy of log a, but a rogue process injected exactly one extra order, so b contains every id in a (same multiplicities) plus one additional id.
a = [5, 2, 9]
b = [2, 9, 5, 7] # same ids as a, plus 7
-> 7
Find the injected id in time and space. A frequency map works but costs memory; use the bit trick.
Show a hint
What happens if you XOR every id in both logs into one accumulator?
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.