Encode and Decode Strings

Medium

Description

Design an algorithm to encode a list of strings to a single string and decode it back to the original list of strings.

Examples

Input:strs = ["hello","world"]
Output:["hello","world"]
Explanation:

Encode then decode returns original.

Input:strs = [""]
Output:[""]
Explanation:

Edge case with minimal input.

Input:strs = ["4:abc", "delimiter#test", "normal"]
Output:["4:abc", "delimiter#test", "normal"]
Explanation:

Tests handling of strings containing potential delimiter characters like colons and special symbols. The encoding algorithm must choose delimiters that won't interfere with the actual string content.

Constraints

  • 0 ≤ strs.length ≤ 200
  • 0 ≤ strs[i].length ≤ 200

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!