DSA Key Problems

String Compression

Given an array of characters, compress each consecutive run in place to its character followed, when the run exceeds one, by the decimal digits of its length. Return the compressed length, with the compressed characters occupying the first part of the array.