sent was shipped. On the way exactly two numbers got lost, and the same integer x (possibly negative or zero) was added to each of the rest. What arrived is received.
Collections are compared regardless of order: only which numbers appear and how many times matters.
Return the smallest x for which this could have happened.sent=[7, 3, 9, 5], received=[11, 7] → 2
x = 4 turns 3 and 7 into 7 and 11; x = 2 turns 5 and 9 into 7 and 11. The smaller shift is 2.
sent=[6, 6, 6], received=[1] → -5
Any two numbers went missing, and the remaining 6 became 1: x = -5.
sent=[0, 10, 20, 30, 40], received=[25, 35, 45] → 5
0 and 10 were lost, and the rest moved up by 5.
x existssent=[7, 3, 9, 5], received=[11, 7]
2
Run checks the first 3 tests in your browser. Submit checks all 32 tests on the server, hidden ones included.