# Match the Combination [duplicate]

A Number Lock has 3 digit key. ### that should fulfil the following conditions:

6 8 2 - One Number is well placed and correct.
6 1 4 - One Number is correct but wrong placed.
2 0 6 - Two Numbers are correct but wrong placed.
7 3 8 - Nothing is correct.
7 8 0 - One Number is correct but wrong placed.

Can you crack the code ?

One of 6 8 2 is correct and the right spot. By the second line, we can eliminate 6, which didn't change position, but would now have to be in the wrong spot. By the 5th line, we eliminate 8, as well. This means that the code is x x 2.
The third line tells us that 0 is in the code, but not in the middle or last position. The code is now 0 x 2. Neither of these numbers appears in the second line, which indicates that either 1 or 4 is correct, but not in the right spot. The only one of these two not in the middle is 4, therefore, the code is 0 4 2.