Question: Run Length Encoding Implement run-length encoding on strings. Run-length encoding collapses consecutive instances of a single character into two pieces of information: the number of
Run Length Encoding Implement run-length encoding on strings. Run-length encoding collapses consecutive instances of a single character into two pieces of information: the number of instances and the Note that even single characters should be run length encoded. If the string is empty, return an empty string Your implementation should work on all alphanumeric characters. Complete the runlengthEncode function which takes a string input as a parameter and returns the compressed string. Sample Input GGGGGrmrrrrrrrrrrrrrrt Sample Output 5G14r1t Explanation There are 5 'G' characters then there are 14 'r' s then there is 1 't
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
