I have forgotten my 5-character computer password, but I know that it consists of the letters a, b, c, d, e in some order. When I enter a potential password into the computer, it tells me exactly how many of the letters are in the correct position.
When I enter abcde, it tells me that none of the letters are in the correct position. The same happens when I enter cdbea and eadbc.
Using the best strategy, how many further attempts must I make in order to guarantee that I can deduce the correct password?
- ANone: I can deduce it immediately
- BOne
- CTwo
- DThree
- EMore than three
Show the answer and worked solution
answer · B
- ANone: I can deduce it immediately
- BOne
- CTwo
- DThree
- EMore than three
Work position by position. Each position must avoid the letter the three failed guesses put there, which leaves position 1 as b or d, position 2 as c or e, position 3 as a or e, position 4 as a or c, and position 5 as b or d. Positions 1 and 5 must take b and d in some order, and the middle three must be either c, e, a or e, a, c, so exactly four candidates survive: bcead, beacd, dceab and deacb. One more attempt is therefore needed, and one is enough: entering bcead returns 5, 2, 3 and 0 for those four in turn, so whatever number comes back identifies the password.