Coding

Implement String Compression

Implement string compression.

Input: chars = ["a","b","b","b","b","b","b","b","b","b","b","b","b"]

Output: ["a","b","1","2"]

Explanation: The letter 'a' appears once (so no number is appended), and 'b' appears 12 times, modifying the array in place to length 4.

Was asked at

Practice this question with AI

First session is free - no credit card required.

Go Premium

More interviews, more skills, more success.

Community Answers

1 answer from the community

Unlock Full Access

Answer any un-answered question from our database to unlock all community answers for 30 days.

Give & Take

Practice More Questions

3 answers published. Last candidate submission on Sep 20 2026, 2:29am PDT. Interview question asked to Software Engineers interviewing at Aurora, Carousell, Cisco Systems and other companies. Original question asked: Implement String Compression. Question last reported by a candidate interviewing at Anaplan for a Software Engineer interview on Oct 6 2026, 12:14pm PDT.