Reported September 2026
Abridgetwo pointers

String Compression

Reported by candidates from Abridge's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Abridge OA. Under 2s to a working solution.
Founder's read

The Abridge OA reported in September 2026 looks like a string problem, but it's really just run-length encoding with one twist. Group consecutive equal characters, write the character, and append the count only when it's above one. That's the whole task. Candidates still miss it because multi-digit counts like 12 trip up anyone who thinks in single characters. If you've got an invite and 48 hours, this is a ten-minute problem you can't afford to fumble. StealthCoder sits invisibly on your screen as a safety net in the live OA, so if your mind goes blank on the run boundary logic, you still have a working solution.

The problem

Given a string chars, compress each maximal run of equal consecutive characters.
Write the character once.
If the run length is greater than one, immediately follow it with the decimal digits of that length.
Return the complete compressed string. Run counts may contain multiple digits.

Function
compress(chars: String) → String

Examples
Example 1
chars = "aabbccc"
return = "a2b2c3"
The consecutive runs have lengths 2, 2, and 3.
Example 2
chars = "a"
return = "a"
A run of length one has no numeric suffix.
Example 3
chars = "abbbbbbbbbbbb"
return = "ab12"
The first run has length one, and the twelve consecutive b characters use the two digits 12.

Constraints
1 <= chars.length <= 100000.
chars contains printable ASCII characters other than line breaks.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is a single pass with two pointers. Set i at the start of a run, move j forward while chars[j] equals chars[i], then compute the run length as j - i. Append chars[i] to a builder. If the length is greater than one, append str(length), which handles 12, 100, or 100000 automatically. Then set i = j and repeat. Time is O(n), and with n up to 100000 you must use a list or string builder, not repeated string concatenation in a loop. Common pitfalls: appending the count for runs of length one, forgetting to flush the final run, and writing digits one at a time as if counts were a single character. Also remember the input can include digits as characters, which is fine since you return a new string and never decode. If you blank on the loop structure during the live OA, StealthCoder gives you a clean reference implementation to check against.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill String Compression cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as string compression. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Abridge's OA.

Abridge reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

String Compression FAQ

How hard is the Abridge String Compression problem really?+

It's easy. One pass, no tricky data structures. The only real difficulty is clean run boundaries and multi-digit counts. If you can write a while loop with two indices, you can solve it. Most failures come from off-by-one errors on the last run.

What's the core trick for this problem?+

Scan for maximal runs. Keep a start index, advance until the character changes, then emit the character and, if the run length exceeds one, the decimal length. Convert the integer to a string so 12 becomes two characters. Then jump to the next run start.

Do I need to modify the input in place?+

No. This version asks you to return the complete compressed string, so build a new one. Use a list of characters and join at the end. That avoids quadratic string concatenation on inputs up to 100000 characters.

What edge cases should I test before submitting?+

Test a single character, which returns itself with no suffix. Test a run of exactly ten or more, like twelve b's giving b12. Test all characters identical, all distinct, and a final run at the end of the string. Also try digit characters inside the input.

How do I prepare for this in 48 hours?+

Write the two-pointer run-length loop from memory twice. Then test it on the three given examples plus a long run. Review string builders in your language of choice. That's enough, since the problem has one pattern and very little else going on.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Abridge.

OA at Abridge?
Invisible during screen share
Get it