|
|
|
|
|
by bntyhntr
471 days ago
|
|
At one of my old jobs, the bathroom was locked with a 4 digit code followed by the key symbol.
We jokingly made up "Bathroom Code" as an interview question/to nerd snipe each other instead of working, which was "assuming you don't have to press key, and that the bathroom door will unlock if the correct 4 digits are entered in order at any time, write the code to print the shortest possible test sequence to guarantee you entry". Obviously we didn't give this to any candidates but it's amusing to think that the problem is a lot more interesting than we gave it credit for. |
|
There's a permutation list claimed to be the shortest that I used to carry in my PDA to impress friends that had one of those sorts of cars. If I recall, it was guaranteed to open the door in something like 32 button presses, but it may have been less.
It was because there was no "start" or stop to the sequence, the computer would unlock if the sequence appeared intact anywhere. So a code 3,4,5,6 would trigger with 8,2,7,3,4,5,6,0,2