Skip to content
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

run-length-encoding-exercise: added new exercise. #115

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,14 @@
"prerequisites": [],
"difficulty": 6
},
{
"slug": "run-length-encoding",
"name": "Run-Length Encoding",
"uuid": "3ce411fd-a8d5-4030-b8f8-7ba934227ce1",
"practices": [],
"prerequisites": [],
"difficulty": 8
},
{
"slug": "knapsack",
"name": "Knapsack",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Reserved Memory

The buffer for the input string uses bytes 64-319 of linear memory.

The input string can be modified in place if desired.
20 changes: 20 additions & 0 deletions exercises/practice/run-length-encoding/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Instructions

Implement run-length encoding and decoding.

Run-length encoding (RLE) is a simple form of data compression, where runs (consecutive data elements) are replaced by just one data value and count.

For example we can represent the original 53 characters with only 13.

```text
"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB" -> "12WB12W3B24WB"
```

RLE allows the original data to be perfectly reconstructed from the compressed data, which makes it a lossless data compression.

```text
"AABCCCDEEEE" -> "2AB3CD4E" -> "AABCCCDEEEE"
```

For simplicity, you can assume that the unencoded string will only contain the letters A through Z (either lower or upper case) and whitespace.
This way data to be encoded will never contain any numbers and numbers inside data to be decoded always represent the count for the following character.
18 changes: 18 additions & 0 deletions exercises/practice/run-length-encoding/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"root": true,
"extends": "@exercism/eslint-config-javascript",
"env": {
"jest": true
},
"overrides": [
{
"files": [
"*.spec.js"
],
"excludedFiles": [
"custom.spec.js"
],
"extends": "@exercism/eslint-config-javascript/maintainers"
}
]
}
22 changes: 22 additions & 0 deletions exercises/practice/run-length-encoding/.meta/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"authors": [
"SimaDovakin"
],
"contributors": [
"keiravillekode"
],
"files": {
"solution": [
"run-length-encoding.wat"
],
"test": [
"run-length-encoding.spec.js"
],
"example": [
".meta/proof.ci.wat"
]
},
"blurb": "Implement run-length encoding and decoding.",
"source": "Wikipedia",
"source_url": "https://en.wikipedia.org/wiki/Run-length_encoding"
}
Loading