Code RoomVigenere cipher encryption
MediumPrep Room Coding #1555

Vigenere cipher encryption

CodingSecurityMid–Senior~22 min

Implement Vigenere cipher encryption. Given plaintext `text` and a `key` of letters, shift each alphabetic character of the text by the position of the corresponding key letter (a=0, b=1, ..., z=25), cycling through the key. Preserve the case of each text character. Non-alphabetic characters pass through unchanged and must NOT advance the key position. The key is non-empty and contains only ASCII letters.

Implement
vigenere_encrypt(text: str, key: str) → str
Examples
in["HELLO","KEY"]out"RIJVS"
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 22 min
InputExpectedGot
["HELLO","KEY"]"RIJVS"not run yetsample