Company: Goldman sachs_9aug
Difficulty: medium
Secure my conversations Problem Description Persons A and B uses an encryption based system for their conversation. Each conversation message is encoded from the source and decoded in the destination using a shared private positive number key known to each other. The algorithm is illustrated with an example. Input Format with explanation: 1. Operation (1 for Encoding and 2 for Decoding) 2. Input message 3. Input private key Output Format with explanation: 1. Output message Complete the secureChannel function below: string secureChannel(int operation, string message, string key) Examples Example 1: Input: 1 Open 123 Output: Oppeeen Explanation: Here, the input message characters are duplicated based on each digit in the key. Example 2: Input: 2 Oppeeen 123 Output: Open Explanation: Here, the input message characters are compressed based on each digit in the key. Constraints The conversation message and the private key need NOT be in equal length and the encoding / decoding takes place t