Skip to content

Commit b2bcdef

Browse files
authored
Sync docs and metadata (#323)
1 parent 880c526 commit b2bcdef

File tree

32 files changed

+222
-91
lines changed

32 files changed

+222
-91
lines changed

exercises/practice/affine-cipher/.docs/instructions.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Create an implementation of the affine cipher, an ancient encryption system crea
44

55
The affine cipher is a type of monoalphabetic substitution cipher.
66
Each character is mapped to its numeric equivalent, encrypted with a mathematical function and then converted to the letter relating to its new numeric value.
7-
Although all monoalphabetic ciphers are weak, the affine cipher is much stronger than the atbash cipher, because it has many more keys.
7+
Although all monoalphabetic ciphers are weak, the affine cipher is much stronger than the Atbash cipher, because it has many more keys.
88

99
[//]: # " monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic "
1010

@@ -18,10 +18,10 @@ E(x) = (ai + b) mod m
1818

1919
Where:
2020

21-
- `i` is the letter's index from `0` to the length of the alphabet - 1
21+
- `i` is the letter's index from `0` to the length of the alphabet - 1.
2222
- `m` is the length of the alphabet.
2323
For the Roman alphabet `m` is `26`.
24-
- `a` and `b` are integers which make the encryption key
24+
- `a` and `b` are integers which make up the encryption key.
2525

2626
Values `a` and `m` must be _coprime_ (or, _relatively prime_) for automatic decryption to succeed, i.e., they have number `1` as their only common factor (more information can be found in the [Wikipedia article about coprime integers][coprime-integers]).
2727
In case `a` is not coprime to `m`, your program should indicate that this is an error.

exercises/practice/atbash-cipher/.docs/instructions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Instructions
22

3-
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
3+
Create an implementation of the Atbash cipher, an ancient encryption system created in the Middle East.
44

55
The Atbash cipher is a simple substitution cipher that relies on transposing all the letters in the alphabet such that the resulting alphabet is backwards.
66
The first letter is replaced with the last letter, the second with the second-last, and so on.

exercises/practice/atbash-cipher/.meta/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
".meta/example.sml"
2020
]
2121
},
22-
"blurb": "Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.",
22+
"blurb": "Create an implementation of the Atbash cipher, an ancient encryption system created in the Middle East.",
2323
"source": "Wikipedia",
2424
"source_url": "https://en.wikipedia.org/wiki/Atbash"
2525
}

exercises/practice/darts/.docs/instructions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Instructions
22

3-
Write a function that returns the earned points in a single toss of a Darts game.
3+
Calculate the points scored in a single toss of a Darts game.
44

55
[Darts][darts] is a game where players throw darts at a [target][darts-target].
66

@@ -16,7 +16,7 @@ In our particular instance of the game, the target rewards 4 different amounts o
1616
The outer circle has a radius of 10 units (this is equivalent to the total radius for the entire target), the middle circle a radius of 5 units, and the inner circle a radius of 1.
1717
Of course, they are all centered at the same point — that is, the circles are [concentric][] defined by the coordinates (0, 0).
1818

19-
Write a function that given a point in the target (defined by its [Cartesian coordinates][cartesian-coordinates] `x` and `y`, where `x` and `y` are [real][real-numbers]), returns the correct amount earned by a dart landing at that point.
19+
Given a point in the target (defined by its [Cartesian coordinates][cartesian-coordinates] `x` and `y`, where `x` and `y` are [real][real-numbers]), calculate the correct score earned by a dart landing at that point.
2020

2121
## Credit
2222

exercises/practice/darts/.meta/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
".meta/example.sml"
1414
]
1515
},
16-
"blurb": "Write a function that returns the earned points in a single toss of a Darts game.",
16+
"blurb": "Calculate the points scored in a single toss of a Darts game.",
1717
"source": "Inspired by an exercise created by a professor Della Paolera in Argentina"
1818
}

exercises/practice/eliuds-eggs/.docs/introduction.md

+33-15
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,54 @@ The position information encoding is calculated as follows:
1212
2. Convert the number from binary to decimal.
1313
3. Show the result on the display.
1414

15-
Example 1:
15+
## Example 1
16+
17+
![Seven individual nest boxes arranged in a row whose first, third, fourth and seventh nests each have a single egg.](https://assets.exercism.org/images/exercises/eliuds-eggs/example-1-coop.svg)
1618

1719
```text
18-
Chicken Coop:
1920
_ _ _ _ _ _ _
2021
|E| |E|E| | |E|
22+
```
23+
24+
### Resulting Binary
25+
26+
![1011001](https://assets.exercism.org/images/exercises/eliuds-eggs/example-1-binary.svg)
27+
28+
```text
29+
_ _ _ _ _ _ _
30+
|1|0|1|1|0|0|1|
31+
```
2132

22-
Resulting Binary:
23-
1 0 1 1 0 0 1
33+
### Decimal number on the display
2434

25-
Decimal number on the display:
2635
89
2736

28-
Actual eggs in the coop:
37+
### Actual eggs in the coop
38+
2939
4
40+
41+
## Example 2
42+
43+
![Seven individual nest boxes arranged in a row where only the fourth nest has an egg.](https://assets.exercism.org/images/exercises/eliuds-eggs/example-2-coop.svg)
44+
45+
```text
46+
_ _ _ _ _ _ _
47+
| | | |E| | | |
3048
```
3149

32-
Example 2:
50+
### Resulting Binary
51+
52+
![0001000](https://assets.exercism.org/images/exercises/eliuds-eggs/example-2-binary.svg)
3353

3454
```text
35-
Chicken Coop:
36-
_ _ _ _ _ _ _ _
37-
| | | |E| | | | |
55+
_ _ _ _ _ _ _
56+
|0|0|0|1|0|0|0|
57+
```
3858

39-
Resulting Binary:
40-
0 0 0 1 0 0 0 0
59+
### Decimal number on the display
4160

42-
Decimal number on the display:
4361
16
4462

45-
Actual eggs in the coop:
63+
### Actual eggs in the coop
64+
4665
1
47-
```

exercises/practice/eliuds-eggs/.meta/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
},
1616
"blurb": "Help Eliud count the number of eggs in her chicken coop by counting the number of 1 bits in a binary representation.",
1717
"source": "Christian Willner, Eric Willigers",
18-
"source_url": "https://forum.exercism.org/t/new-exercise-suggestion-eliuds-eggs/7632/5"
18+
"source_url": "https://forum.exercism.org/t/new-exercise-suggestion-pop-count/7632/5"
1919
}

exercises/practice/flatten-array/.docs/instructions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Take a nested list and return a single flattened list with all values except nil/null.
44

5-
The challenge is to write a function that accepts an arbitrarily-deep nested list-like structure and returns a flattened structure without any nil/null values.
5+
The challenge is to take an arbitrarily-deep nested list-like structure and produce a flattened structure without any nil/null values.
66

77
For example:
88

exercises/practice/hamming/.docs/instructions.md

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,15 @@
11
# Instructions
22

3-
Calculate the Hamming Distance between two DNA strands.
3+
Calculate the Hamming distance between two DNA strands.
44

5-
Your body is made up of cells that contain DNA.
6-
Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells.
7-
In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime!
8-
9-
When cells divide, their DNA replicates too.
10-
Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information.
11-
If we compare two strands of DNA and count the differences between them we can see how many mistakes occurred.
12-
This is known as the "Hamming Distance".
13-
14-
We read DNA using the letters C,A,G and T.
5+
We read DNA using the letters C, A, G and T.
156
Two strands might look like this:
167

178
GAGCCTACTAACGGGAT
189
CATCGTAATGACGGCCT
1910
^ ^ ^ ^ ^ ^^
2011

21-
They have 7 differences, and therefore the Hamming Distance is 7.
22-
23-
The Hamming Distance is useful for lots of things in science, not just biology, so it's a nice phrase to be familiar with :)
12+
They have 7 differences, and therefore the Hamming distance is 7.
2413

2514
## Implementation notes
2615

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Introduction
2+
3+
Your body is made up of cells that contain DNA.
4+
Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells.
5+
In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime!
6+
7+
When cells divide, their DNA replicates too.
8+
Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information.
9+
If we compare two strands of DNA and count the differences between them, we can see how many mistakes occurred.
10+
This is known as the "Hamming distance".
11+
12+
The Hamming distance is useful in many areas of science, not just biology, so it's a nice phrase to be familiar with :)

exercises/practice/hamming/.meta/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
".meta/example.sml"
2121
]
2222
},
23-
"blurb": "Calculate the Hamming difference between two DNA strands.",
23+
"blurb": "Calculate the Hamming distance between two DNA strands.",
2424
"source": "The Calculating Point Mutations problem at Rosalind",
2525
"source_url": "https://rosalind.info/problems/hamm/"
2626
}

exercises/practice/knapsack/.docs/instructions.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Instructions
22

3-
Your task is to determine which items to take so that the total value of his selection is maximized, taking into account the knapsack's carrying capacity.
3+
Your task is to determine which items to take so that the total value of her selection is maximized, taking into account the knapsack's carrying capacity.
44

55
Items will be represented as a list of items.
66
Each item will have a weight and value.
77
All values given will be strictly positive.
8-
Bob can take only one of each item.
8+
Lhakpa can take only one of each item.
99

1010
For example:
1111

@@ -21,5 +21,5 @@ Knapsack Maximum Weight: 10
2121
```
2222

2323
For the above, the first item has weight 5 and value 10, the second item has weight 4 and value 40, and so on.
24-
In this example, Bob should take the second and fourth item to maximize his value, which, in this case, is 90.
25-
He cannot get more than 90 as his knapsack has a weight limit of 10.
24+
In this example, Lhakpa should take the second and fourth item to maximize her value, which, in this case, is 90.
25+
She cannot get more than 90 as her knapsack has a weight limit of 10.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Introduction
22

3-
Bob is a thief.
4-
After months of careful planning, he finally manages to crack the security systems of a fancy store.
3+
Lhakpa is a [Sherpa][sherpa] mountain guide and porter.
4+
After months of careful planning, the expedition Lhakpa works for is about to leave.
5+
She will be paid the value she carried to the base camp.
56

6-
In front of him are many items, each with a value and weight.
7-
Bob would gladly take all of the items, but his knapsack can only hold so much weight.
8-
Bob has to carefully consider which items to take so that the total value of his selection is maximized.
7+
In front of her are many items, each with a value and weight.
8+
Lhakpa would gladly take all of the items, but her knapsack can only hold so much weight.
9+
10+
[sherpa]: https://en.wikipedia.org/wiki/Sherpa_people#Mountaineering

exercises/practice/luhn/.docs/instructions.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ The first step of the Luhn algorithm is to double every second digit, starting f
2222
We will be doubling
2323

2424
```text
25-
4_3_ 3_9_ 0_4_ 6_6_
25+
4539 3195 0343 6467
26+
↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ (double these)
2627
```
2728

2829
If doubling the number results in a number greater than 9 then subtract 9 from the product.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Instructions
22

33
Given a string containing brackets `[]`, braces `{}`, parentheses `()`, or any combination thereof, verify that any and all pairs are matched and nested correctly.
4-
The string may also contain other characters, which for the purposes of this exercise should be ignored.
4+
Any other characters should be ignored.
5+
For example, `"{what is (42)}?"` is balanced and `"[text}"` is not.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Introduction
2+
3+
You're given the opportunity to write software for the Bracketeer™, an ancient but powerful mainframe.
4+
The software that runs on it is written in a proprietary language.
5+
Much of its syntax is familiar, but you notice _lots_ of brackets, braces and parentheses.
6+
Despite the Bracketeer™ being powerful, it lacks flexibility.
7+
If the source code has any unbalanced brackets, braces or parentheses, the Bracketeer™ crashes and must be rebooted.
8+
To avoid such a scenario, you start writing code that can verify that brackets, braces, and parentheses are balanced before attempting to run it on the Bracketeer™.
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,35 @@
11
# Instructions
22

3-
Compute Pascal's triangle up to a given number of rows.
3+
Your task is to output the first N rows of Pascal's triangle.
44

5-
In Pascal's Triangle each number is computed by adding the numbers to the right and left of the current position in the previous row.
5+
[Pascal's triangle][wikipedia] is a triangular array of positive integers.
6+
7+
In Pascal's triangle, the number of values in a row is equal to its row number (which starts at one).
8+
Therefore, the first row has one value, the second row has two values, and so on.
9+
10+
The first (topmost) row has a single value: `1`.
11+
Subsequent rows' values are computed by adding the numbers directly to the right and left of the current position in the previous row.
12+
13+
If the previous row does _not_ have a value to the left or right of the current position (which only happens for the leftmost and rightmost positions), treat that position's value as zero (effectively "ignoring" it in the summation).
14+
15+
## Example
16+
17+
Let's look at the first 5 rows of Pascal's Triangle:
618

719
```text
820
1
921
1 1
1022
1 2 1
1123
1 3 3 1
1224
1 4 6 4 1
13-
# ... etc
1425
```
26+
27+
The topmost row has one value, which is `1`.
28+
29+
The leftmost and rightmost values have only one preceding position to consider, which is the position to its right respectively to its left.
30+
With the topmost value being `1`, it follows from this that all the leftmost and rightmost values are also `1`.
31+
32+
The other values all have two positions to consider.
33+
For example, the fifth row's (`1 4 6 4 1`) middle value is `6`, as the values to its left and right in the preceding row are `3` and `3`:
34+
35+
[wikipedia]: https://en.wikipedia.org/wiki/Pascal%27s_triangle
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Introduction
2+
3+
With the weather being great, you're not looking forward to spending an hour in a classroom.
4+
Annoyed, you enter the class room, where you notice a strangely satisfying triangle shape on the blackboard.
5+
Whilst waiting for your math teacher to arrive, you can't help but notice some patterns in the triangle: the outer values are all ones, each subsequent row has one more value than its previous row and the triangle is symmetrical.
6+
Weird!
7+
8+
Not long after you sit down, your teacher enters the room and explains that this triangle is the famous [Pascal's triangle][wikipedia].
9+
10+
Over the next hour, your teacher reveals some amazing things hidden in this triangle:
11+
12+
- It can be used to compute how many ways you can pick K elements from N values.
13+
- It contains the Fibonacci sequence.
14+
- If you color odd and even numbers differently, you get a beautiful pattern called the [Sierpiński triangle][wikipedia-sierpinski-triangle].
15+
16+
The teacher implores you and your classmates to lookup other uses, and assures you that there are lots more!
17+
At that moment, the school bell rings.
18+
You realize that for the past hour, you were completely absorbed in learning about Pascal's triangle.
19+
You quickly grab your laptop from your bag and go outside, ready to enjoy both the sunshine _and_ the wonders of Pascal's triangle.
20+
21+
[wikipedia]: https://en.wikipedia.org/wiki/Pascal%27s_triangle
22+
[wikipedia-sierpinski-triangle]: https://en.wikipedia.org/wiki/Sierpi%C5%84ski_triangle

exercises/practice/pig-latin/.docs/instructions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ For example:
1919

2020
## Rule 2
2121

22-
If a word begins with a one or more consonants, first move those consonants to the end of the word and then add an `"ay"` sound to the end of the word.
22+
If a word begins with one or more consonants, first move those consonants to the end of the word and then add an `"ay"` sound to the end of the word.
2323

2424
For example:
2525

@@ -33,7 +33,7 @@ If a word starts with zero or more consonants followed by `"qu"`, first move tho
3333

3434
For example:
3535

36-
- `"quick"` -> `"ickqu"` -> `"ay"` (starts with `"qu"`, no preceding consonants)
36+
- `"quick"` -> `"ickqu"` -> `"ickquay"` (starts with `"qu"`, no preceding consonants)
3737
- `"square"` -> `"aresqu"` -> `"aresquay"` (starts with one consonant followed by `"qu`")
3838

3939
## Rule 4

exercises/practice/protein-translation/.docs/instructions.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
Translate RNA sequences into proteins.
44

5-
RNA can be broken into three nucleotide sequences called codons, and then translated to a polypeptide like so:
5+
RNA can be broken into three-nucleotide sequences called codons, and then translated to a protein like so:
66

77
RNA: `"AUGUUUUCU"` => translates to
88

99
Codons: `"AUG", "UUU", "UCU"`
10-
=> which become a polypeptide with the following sequence =>
10+
=> which become a protein with the following sequence =>
1111

1212
Protein: `"Methionine", "Phenylalanine", "Serine"`
1313

@@ -27,9 +27,9 @@ Protein: `"Methionine", "Phenylalanine", "Serine"`
2727

2828
Note the stop codon `"UAA"` terminates the translation and the final methionine is not translated into the protein sequence.
2929

30-
Below are the codons and resulting Amino Acids needed for the exercise.
30+
Below are the codons and resulting amino acids needed for the exercise.
3131

32-
| Codon | Protein |
32+
| Codon | Amino Acid |
3333
| :----------------- | :------------ |
3434
| AUG | Methionine |
3535
| UUU, UUC | Phenylalanine |

exercises/practice/pythagorean-triplet/.docs/instructions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Instructions
1+
# Description
22

33
A Pythagorean triplet is a set of three natural numbers, {a, b, c}, for which,
44

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Introduction
2+
3+
You are an accomplished problem-solver, known for your ability to tackle the most challenging mathematical puzzles.
4+
One evening, you receive an urgent letter from an inventor called the Triangle Tinkerer, who is working on a groundbreaking new project.
5+
The letter reads:
6+
7+
> Dear Mathematician,
8+
>
9+
> I need your help.
10+
> I am designing a device that relies on the unique properties of Pythagorean triplets — sets of three integers that satisfy the equation a² + b² = c².
11+
> This device will revolutionize navigation, but for it to work, I must program it with every possible triplet where the sum of a, b, and c equals a specific number, N.
12+
> Calculating these triplets by hand would take me years, but I hear you are more than up to the task.
13+
>
14+
> Time is of the essence.
15+
> The future of my invention — and perhaps even the future of mathematical innovation — rests on your ability to solve this problem.
16+
17+
Motivated by the importance of the task, you set out to find all Pythagorean triplets that satisfy the condition.
18+
Your work could have far-reaching implications, unlocking new possibilities in science and engineering.
19+
Can you rise to the challenge and make history?

0 commit comments

Comments
 (0)