Search⌘ K
AI Features

String Compression

String Compression replaces consecutive groups in a character array with each character and, when needed, its count. Write the result in place and return its new length. Use constant extra space.

Statement

Given an array of characters, chars, compress it in place according to the following rules: ...