Solution: String Compression
Explore how to compress a character array in place by applying the two pointers approach to run-length encoding. Understand how to identify consecutive character groups, overwrite the original array efficiently, and return the new compressed length while using only constant extra space.
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
...