Loading...

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
mid

Problem

Our log compression service uses run-length encoding to reduce storage costs. Write a function called run_length_encode that takes a string and returns its compressed form - consecutive identical characters become the character followed by its run count.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.