Quant Memo
Coding/●●●●●

Decode a run-length string

Reverse run-length encoding: given a string that is a sequence of <character><count> pairs, rebuild the original text. Counts can be more than one digit.

"a2b1c5a3"  ->  "aabcccccaaa"
"x12"       ->  "xxxxxxxxxxxx"     # twelve x's
""          ->  ""

Return the decoded string in O(output length)O(\text{output length}) time. Assume characters are letters and each is followed by a count of at least 1.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions