String Compression
A medium-tier problem at 58% community acceptance, tagged with Two Pointers, String. Reported in interviews at CrowdStrike and 24 others.
String Compression shows up in live assessments at Salesforce, Snap, Lyft, and at least a dozen other companies you've probably heard of. The problem looks simple: compress a string by replacing consecutive identical characters with the character and its count. Sounds straightforward until you're on the clock and realize the trick is doing it in-place without extra space, and most candidates burn time on the wrong approach. If this specific problem hits your OA and you blank on the pattern, StealthCoder solves it invisibly while you're screen-sharing.
Companies that ask "String Compression"
String Compression is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.
Get StealthCoderThe gotcha is that you can't just build a new string and return it. The problem demands in-place compression, which means you need two pointers: one to read characters and one to write the compressed result back into the same array. Most people skip this constraint on first read and waste time optimizing the wrong solution. The real pattern is counting consecutive characters, calculating how much space you'll need upfront, then doing a second pass to actually write the compressed characters and counts. This is where two-pointer technique earns its keep. The acceptance rate sits around 58 percent, which tells you people are getting tripped up. When you hit this live and feel the time pressure building, StealthCoder is your hedge.
Pattern tags
You know the problem.
Make sure you actually pass it.
String Compression recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.
String Compression interview FAQ
Is String Compression still being asked at big companies?+
Yes. Twenty-five companies report asking it, including Salesforce, Snap, Lyft, Expedia, and Palo Alto Networks. It's not a relic. The 58 percent acceptance rate shows it's harder than it looks in practice, which keeps it on rotation.
What's the main trick that people miss?+
The in-place constraint. Most candidates write a new string and return it, which passes smaller examples but fails when there's strict space limits. You need two pointers: one scanning forward, one writing backward or in-place. That's the pattern.
How does String Compression relate to two-pointer problems?+
It's a textbook two-pointer application. One pointer traverses to count characters, the other writes the compressed result back. It teaches you how pointers coordinate when you can't use extra space and need to modify the input directly.
Should I practice this before an OA at Snap or Salesforce?+
If those are on your target list, yes. It's asked frequently enough that skipping it is risky. Drill the two-pointer approach, understand why the in-place constraint exists, and practice writing the count back to the array.
What if I freeze on this during the assessment?+
That's where preparation plus a real-time safety net matters. If you've drilled the pattern, you'll recognize it. If you blank, you have StealthCoder running invisibly to get you unstuck and show a working solution while you're on screen share.
Want the actual problem statement? View "String Compression" on LeetCode →