Optimal Algorithmic Approach
Length-prefix encoding: `len(s) + '#' + s`.
Core Invariants & Edge Cases
- Prefix each string with its length followed by a fixed separator e.g. '5#hello'
- Decode reads the length, then reads exactly that many characters
- This handles any characters including the separator