Katkat

Implement delimiter-free string codec

OpenAISoftware Engineer · Technical Screen

Last 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]) -> str
  • decode(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.