Skip to main content

Practice · 1 of 1

Property: Round-Trip Codec

CHALLENGE
Difficulty: advanced+25 XP

Implement both halves of a tiny codec and prove the round-trip property: decode(encode(v)) == v for every vector. Encoding: run-length, e.g. {3,3,3,5} -> "3x3,1x5". Decode parses that exact format back. Empty vector encodes to the empty string and decodes back to empty.

Back to lesson: Practice: Practice: Round-Trip Codecs