Back to problems

Encode and Decode Strings (LC 271)

Algorithm · Snowflake · Medium

Requirements This was posed as a coding question in a phone screen. Implement a pair of functions that serialize and deserialize a list of strings: encode(strs: list[str]) -> str converts a list of strings into a single string. decode(s: str) -> list[str] takes the string produced by encode and reconstructs the original list exactly. The input strings may contain any character at all, including whatever character you might consider using as a separator, and any of them may…

Loading the rest of the question…