You will write a run-length encoder and decoder, and use them to measure the saving.
Your tasks.
encode, return the list of [count, character] pairs of the string text.decode, rebuild the string from a list of pairs.saving, return the number of bytes saved, if each character, count and value takes 1 byte. A negative answer means the encoded text is bigger.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…