Skip to content

Add Run Length Encoding and Decoding [#2719] #2968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jeetshah-410
Copy link

@jeetshah-410 jeetshah-410 commented Jul 17, 2025

This PR adds the implementation of Run Length Encoding and Decoding as part of the string compression algorithms.

Features:
encode() function: Compresses a string by converting consecutive repeated characters into a single character followed by the count.

decode() function: Expands the encoded string back to its original form.

File path:
strings/run_length_encoding.cpp

Example:
Input: "aaabbcdddd"

Encoded: "a3b2c1d4"

Decoded: "aaabbcdddd"

This implementation is simple, clear, and includes a main() function to demonstrate the functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants