← Truminds questions

Compress a string into character counts such as 3a2b3c

Filed under Truminds

The question

Given a string like 'abcaabcc', output the count of each character in the form '3a2b3c', targeting O(n) time and O(1) space.

No write-up yet. Related questions below have one.

Related Truminds questions

Collected from public candidate posts and coding forums. Updated Nov 2026.