left and right. Form every pair that takes one number from left and one from right, so each element of left is paired with each element of right exactly once. For each pair, compute the bitwise XOR of its two numbers.
Return the bitwise XOR of all those values.
There can be up to 10¹⁰ pairs, so listing them all is out of the question; look for a pattern.left=[6, 9], right=[4, 1, 7] → 15
The pairs give 6^4=2, 6^1=7, 6^7=1, 9^4=13, 9^1=8, 9^7=14. The XOR of all six is 2^7^1^13^8^14 = 15.
left=[5, 5], right=[3, 12] → 0
Every number takes part in an even number of pairs, so everything cancels out and the result is 0.
left=[11], right=[2] → 9
left=[6, 9], right=[4, 1, 7]
15
Run checks the first 3 tests in your browser. Submit checks all 99 tests on the server, hidden ones included.