Company: Factset
Difficulty: medium
Lexicographically Minimal String Encryption Problem Statement You are given a string originalString . You must encrypt it and produce a string called encryptedString . Begin with two empty strings, temporaryString and encryptedString . Then repeat the following until originalString and temporaryString are both empty. At each step you choose exactly one of these two operations, and you may only choose an operation that is currently valid: Remove the first character of originalString and append it to the end of temporaryString . This operation is valid only while originalString is non-empty. Remove the last character of temporaryString and append it to the end of encryptedString . This operation is valid only while temporaryString is non-empty. The process ends only when every character has been moved into encryptedString , so encryptedString always ends up with exactly the same length as the original input. Different orders of operations produce different results. Choose an order that m