Suppose that out of the integers from 1 to \(n\) inclusive, you are given \(n-2\) of them.

To identify which are the two missing numbers, Chris proposed the following solution :

Let the two numbers be \(x\) and \(y\).

The value of \(x+y\) can be found by taking the sum of the first \(n\) numbers and subtract by the sum of the \(n-2\) given numbers.

The value of \(x\oplus y\) can be found by taking the xor of the first \(n\) numbers and xor it with the xor of the \(n-2\) given numbers.

Solve the system of equation, then we can find the two missing numbers.

The solution is actually wrong. Which of the following cases can disprove Chris' solution?

×

Problem Loading...

Note Loading...

Set Loading...