354. Missax Apr 2026
x = 1 xor 2 xor … xor (N+1) xor a1 xor a2 … xor aN Every value that appears twice cancels out, leaving the missing number. Both approaches are linear in time and constant in memory. For each test case
All the numbers belong to the set
S = (sum of present numbers) + m = T + m Rearranging gives m = S – T . ∎ The algorithm computes missing = S – T . 354. Missax
The input may contain several test cases. Each test case is described as follows x = 1 xor 2 xor … xor