Skip to content

runlengthencodingrun

bradendubois edited this page Nov 8, 2021 · 7 revisions

Run-Length Encoding, Run!

ID: runlengthencodingrun

Difficulty: 1.9

CPU Time: 1 second

Memory: 1024 MB

Solution

For decoding) check every second character, starting at the first character (the one to output), and loop the amount of times of the number immediately following, outputting this character. For encoding, one can loop through the string and simply count the occurrences of each character, and output the character and tally as one goes.

Clone this wiki locally