Here is the interview question prompt, presented for reference.
Encryption means encoding a string using some pre-defined formula. It is widely used for securing and protecting sensitive information over the internet from theft and data breaches.
Suppose an English text has to be encrypted using the following procedure for encoding:
L
is the length of the stringrows x columns
Let’s say we have a string “a quick brown fox jumps over the fence.” After removing spaces, we have L = 31, and can calculate that the √L value is between 5
and 6
, so the resulting grid would have 5
rows and 6
columns like below:
aquick
brownf
oxjump
soverth
efence
The output would be a string displaying characters in each column, separated by whitespaces. So the string will display characters from the first column followed by a whitespace, and then the second column followed by a whitespace, and so on…
Here’s how the output will look like for the example string given above:
“aboshe qrxoe uojvf iwuee cnmrn kfptc”
You can see the full challenge with visuals at this link.
Challenges • Asked over 2 years ago by Jake from AlgoDaily
This is the main discussion thread generated for Matrix Encryption (Main Thread).