Code Room
CodingMediumcod-g992
Subject CryptographyLevel Mid–Senior~22 minCommon in Security interviewsIndustries Software development

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.