Algorithm · Karat · Medium
You are handed a plaintext message. To encrypt it, write the characters of the message into a grid one row at a time, filling each row from left to right before moving to the next. Once the grid is filled, produce the ciphertext by reading the characters back out column by column. The interview continues in stages that build on this first step. Follow-ups A later stage adds a substitution cipher driven by a key: each character of the message is replaced according to that…