Run Length Encoding
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L4
Problem
Given a string, return its run-length encoding: each run of identical characters is replaced by the character followed by its run length (as a decimal integer, even if the run is 1).
Summary
AAABBB becomes 3A3B. Compress it.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.