← 返回 amazon 的题目列表Encode and Decode List of Strings Using Custom Delimiter
类型:online_judge
amazon
Coding Question
Implement encoding and decoding functionality.
Requirement: Implement a method encode that takes a list of strings as input and returns a single encoded string such that a corresponding decode method can revert to the original list.
Example:
Input: ['hello', 'world']
Output: Encoded string
Function Signature:
class Codec:
def encode(self, strs: List[str]) -> str:
# Implement this method
def decode(self, s: str) -> List[str]:
# Implement this method
Ensure the encoded string is correctly formatted to allow accurate decoding.
Example
Input
['hello', 'world']