Question
SSTable blocks shrink keys with front coding (prefix compression). Given a list of string keys sorted ascending, encode each key (after the first) as [shared, suffix] where `shared` is the length of the longest common prefix it shares with the IMMEDIATELY PRECEDING key, and `suffix` is the remaining characters of the key after that shared prefix. The first key is stored whole as [0, key]. To prove the encoding is lossless, DECODE it back by reconstructing each key as previous_key[:shared] + suffix, and return the decoded list of keys (which must equal the input). Keys total <= 10^5 characters.
prefix_compress_roundtrip(keys: list[str]) → list[str][["apple","applet","apply"]]out["apple","applet","apply"]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.