Decode Password Interview Question
Anonymous User
858

Have been trying to solve this today but couldnt get to a solution.

Question
You've been trying to gain entry to the lab for a while now. To open the door, you need to enter a password on the keyboard connected to it. To that end, you've been watching and meticulously recording everything you can see around the entrance. You've finally had a big break when you were able to acquire the notes of technicians:

Input: anagram

Rotation table:

anagrama
agramana
ramanagr
managram

Sort table:

agramanagr
anagramana
ma
ramanagram

Output:
nr$aaagm

After carefully studying the notes, you've managed to decipher them. The string is treated as if it is wrapped around a ring, and that ring is rotated.

  1. Start with the input string (Input)
  2. append an end marker ($)
  3. take the word and rotate it by moving the first character to the end.
  4. add each rotation to a table and repeat (3) until you get back to the original order (Rotation table)
  5. sort the rotations, with the end marker sorting to the end (Sort table)
  6. take the final column as the output (Output)

The note also contains something that you have reason to suspect is the password after having been put through the above process.

Output:
endrtednedd:/os....cp.rnnn.rhhps/.tt$sfeaiaaofd.ow.otooapa.asu./thhse

From this output, how can we get the original string (i.e. password) back. Example using nr$aaagm as output, the password is anagram.

Comments (6)