Home
Log in
DescriptionSubmissionsSolution
DescriptionSubmissionsSolution
Loading...

Log in to run or submit

strs =

Codey

Practise coding problems, test your solutions and track your progress.

Explore

  • Problems
  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

© 2026 Codey. Personal learning project.

Solution
Updated: 2026-02-23

Idea

Encode the list into one string using length-prefixing so any characters (including delimiters) are safe.

Approach

For each string x, append len(x) + '#' + x. To decode, read digits until # to get the length, then take that many characters as the next string.

Why it works

The decoder never guesses boundaries; it uses explicit lengths, so embedded symbols don’t break parsing.

Code
Loading...
Complexity
Time: O(total_chars)
Space: O(total_chars)
Solution
Updated: 2026-02-23

Idea

Encode the list into one string using length-prefixing so any characters (including delimiters) are safe.

Approach

For each string x, append len(x) + '#' + x. To decode, read digits until # to get the length, then take that many characters as the next string.

Why it works

The decoder never guesses boundaries; it uses explicit lengths, so embedded symbols don’t break parsing.

Code
Loading...
Complexity
Time: O(total_chars)
Space: O(total_chars)