Search⌘ K
AI Features

DIY: String Compression

Explore how to compress a list of characters in place using a linear algorithm that handles consecutive repeats and returns the new compressed length. Understand techniques to optimize space and apply this to coding interview problems.

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 ...