The Squeeze
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L3
Problem
A storage layer holds long status strings where the same character tends to repeat in stretches, and we want a compact form of `s`. Replace each stretch of one repeated character with that character followed by how many times it repeats in a row, and always write the count even when a character shows up just once.
Summary
Long stretches of sameness collapse into almost nothing.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.