Implement delimiter-free string codec
OpenAISoftware Engineer · Technical ScreenLast updated
This question evaluates a candidate's ability to design reversible string encodings that handle arbitrary characters and edge cases, testing competency in string manipulation, data serialization, and robustness.
Design an encoder/decoder for a list of strings.
- Implement two functions:
encode(strings: List[str]) -> strdecode(blob: str) -> List[str]- The encoding must be reversible for any input strings (strings may be empty and may contain arbitrary characters).
- You are not allowed to use special delimiter symbols (i.e., you should not rely on a separator character that might appear in the data).
- The encoded output should be a single string.
Explain your approach and analyze time/space complexity.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.