DIY: String Compression
Explore how to implement a string compression algorithm that modifies an input list of characters in-place. Learn to handle consecutive character groups efficiently while maintaining constant space, preparing you for common coding interview problems.
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.