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.

Practice More Questions

2 answers published. Last candidate submission on Jun 2 2026, 6:10am PDT. Interview question asked to Software Engineers interviewing at Okta, TELUS, Transferwise and other companies. Original question asked: Implement String Compression. Question last reported by a candidate interviewing at Zomato for a Software Engineer interview on Jul 31 2026, 10:15pm PDT.