DIY: String Compression
Understand how to compress a list of characters by grouping consecutive repeats and representing them with the character followed by the count. Learn to handle large counts by splitting them and perform the compression in constant space within the original list while returning the new compressed length.
We'll cover the following...
We'll cover the following...
Problem statement
You are given a list of characters. Your task will be to compress this list, using the following algorithm:
For each group of consecutive repeating characters in the string:
- If the group’s length is
1, you will append the character tos.