Solution: String Compression
Understand and apply the two pointers approach to compress an array of characters in place. Learn how to identify groups of repeating characters, write the compressed form efficiently using constant extra space, and calculate the new length of the modified array. This lesson covers run-length encoding implemented directly with optimized pointers.
We'll cover the following...
We'll cover the following...
Statement
Given an array of characters, chars, compress it in place according to the following rules:
Start with an empty string
s.For each group of consecutive repeating characters in
chars:If the group length is
...