Skip to content

Commit b2f3dcc

Browse files
authored
Merge pull request #167 from BNAndras/sync-docs-and-metadata
Sync docs and metadata
2 parents eea2264 + 0999971 commit b2f3dcc

62 files changed

Lines changed: 702 additions & 401 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Description
1+
# Instructions
22

33
Convert a phrase to its acronym.
44

@@ -10,8 +10,8 @@ Punctuation is handled as follows: hyphens are word separators (like whitespace)
1010

1111
For example:
1212

13-
|Input|Output|
14-
|-|-|
15-
|As Soon As Possible|ASAP|
16-
|Liquid-crystal display|LCD|
17-
|Thank George It's Friday!|TGIF|
13+
| Input | Output |
14+
| ------------------------- | ------ |
15+
| As Soon As Possible | ASAP |
16+
| Liquid-crystal display | LCD |
17+
| Thank George It's Friday! | TGIF |

exercises/practice/acronym/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"config.properties"
2121
]
2222
},
23-
"blurb": "Convert a phrase to its acronym.",
23+
"blurb": "Convert a long phrase to its acronym.",
2424
"source": "Julien Vanier",
2525
"source_url": "https://github.com/monkbroc"
2626
}

exercises/practice/allergies/.docs/instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ Now, given just that score of 34, your program should be able to say:
2222
- Whether Tom is allergic to any one of those allergens listed above.
2323
- All the allergens Tom is allergic to.
2424

25-
Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.).
25+
Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.).
2626
Your program should ignore those components of the score.
2727
For example, if the allergy score is 257, your program should only report the eggs (1) allergy.
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# Instructions
22

3-
Your task is to, given a target word and a set of candidate words, to find the subset of the candidates that are anagrams of the target.
3+
Given a target word and one or more candidate words, your task is to find the candidates that are anagrams of the target.
44

55
An anagram is a rearrangement of letters to form a new word: for example `"owns"` is an anagram of `"snow"`.
66
A word is _not_ its own anagram: for example, `"stop"` is not an anagram of `"stop"`.
77

8-
The target and candidates are words of one or more ASCII alphabetic characters (`A`-`Z` and `a`-`z`).
9-
Lowercase and uppercase characters are equivalent: for example, `"PoTS"` is an anagram of `"sTOp"`, but `StoP` is not an anagram of `sTOp`.
10-
The anagram set is the subset of the candidate set that are anagrams of the target (in any order).
11-
Words in the anagram set should have the same letter case as in the candidate set.
8+
The target word and candidate words are made up of one or more ASCII alphabetic characters (`A`-`Z` and `a`-`z`).
9+
Lowercase and uppercase characters are equivalent: for example, `"PoTS"` is an anagram of `"sTOp"`, but `"StoP"` is not an anagram of `"sTOp"`.
10+
The words you need to find should be taken from the candidate words, using the same letter case.
1211

13-
Given the target `"stone"` and candidates `"stone"`, `"tones"`, `"banana"`, `"tons"`, `"notes"`, `"Seton"`, the anagram set is `"tones"`, `"notes"`, `"Seton"`.
12+
Given the target `"stone"` and the candidate words `"stone"`, `"tones"`, `"banana"`, `"tons"`, `"notes"`, and `"Seton"`, the anagram words you need to find are `"tones"`, `"notes"`, and `"Seton"`.

exercises/practice/anagram/.meta/config.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
],
1515
"example": [
1616
".meta/proof.ci.cob"
17+
],
18+
"invalidator": [
19+
"test.ps1",
20+
"test.sh",
21+
"bin/fetch-cobolcheck",
22+
"bin/fetch-cobolcheck.ps1",
23+
"config.properties"
1724
]
1825
},
1926
"blurb": "Given a word and a list of possible anagrams, select the correct sublist.",

exercises/practice/armstrong-numbers/.docs/instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ An [Armstrong number][armstrong-number] is a number that is the sum of its own d
55
For example:
66

77
- 9 is an Armstrong number, because `9 = 9^1 = 9`
8-
- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1`
8+
- 10 is _not_ an Armstrong number, because `10 != 1^2 + 0^2 = 1`
99
- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
10-
- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
10+
- 154 is _not_ an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
1111

1212
Write some code to determine whether a number is an Armstrong number.
1313

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
# Description
1+
# 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

5-
The Atbash cipher is a simple substitution cipher that relies on
6-
transposing all the letters in the alphabet such that the resulting
7-
alphabet is backwards. The first letter is replaced with the last
8-
letter, the second with the second-last, and so on.
5+
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.
6+
The first letter is replaced with the last letter, the second with the second-last, and so on.
97

108
An Atbash cipher for the Latin alphabet would be as follows:
119

@@ -14,13 +12,12 @@ Plain: abcdefghijklmnopqrstuvwxyz
1412
Cipher: zyxwvutsrqponmlkjihgfedcba
1513
```
1614

17-
It is a very weak cipher because it only has one possible key, and it is
18-
a simple mono-alphabetic substitution cipher. However, this may not have
19-
been an issue in the cipher's time.
15+
It is a very weak cipher because it only has one possible key, and it is a simple mono-alphabetic substitution cipher.
16+
However, this may not have been an issue in the cipher's time.
2017

21-
Ciphertext is written out in groups of fixed length, the traditional group size
22-
being 5 letters, leaving numbers unchanged, and punctuation is excluded.
18+
Ciphertext is written out in groups of fixed length, the traditional group size being 5 letters, leaving numbers unchanged, and punctuation is excluded.
2319
This is to make it harder to guess things based on word boundaries.
20+
All text will be encoded as lowercase letters.
2421

2522
## Examples
2623

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"config.properties"
2121
]
2222
},
23-
"blurb": "Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.",
23+
"blurb": "Create an implementation of the Atbash cipher, an ancient encryption system created in the Middle East.",
2424
"source": "Wikipedia",
2525
"source_url": "https://en.wikipedia.org/wiki/Atbash"
2626
}
Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,29 @@
11
# Instructions
22

3-
Implement a binary search algorithm. Do not use any COBOL proprietary
4-
search routines (eg. SEARCH).
3+
Your task is to implement a binary search algorithm.
54

6-
Searching a sorted collection is a common task. A dictionary is a sorted
7-
list of word definitions. Given a word, one can find its definition. A
8-
telephone book is a sorted list of people's names, addresses, and
9-
telephone numbers. Knowing someone's name allows one to quickly find
10-
their telephone number and address.
5+
A binary search algorithm finds an item in a list by repeatedly splitting it in half, only keeping the half which contains the item we're looking for.
6+
It allows us to quickly narrow down the possible locations of our item until we find it, or until we've eliminated all possible locations.
117

12-
If the list to be searched contains more than a few items (a dozen, say)
13-
a binary search will require far fewer comparisons than a linear search,
14-
but it imposes the requirement that the list be sorted.
8+
~~~~exercism/caution
9+
Binary search only works when a list has been sorted.
10+
~~~~
1511

16-
In computer science, a binary search or half-interval search algorithm
17-
finds the position of a specified input value (the search "key") within
18-
an array sorted by key value.
12+
The algorithm looks like this:
1913

20-
In each step, the algorithm compares the search key value with the key
21-
value of the middle element of the array.
14+
- Find the middle element of a _sorted_ list and compare it with the item we're looking for.
15+
- If the middle element is our item, then we're done!
16+
- If the middle element is greater than our item, we can eliminate that element and all the elements **after** it.
17+
- If the middle element is less than our item, we can eliminate that element and all the elements **before** it.
18+
- If every element of the list has been eliminated then the item is not in the list.
19+
- Otherwise, repeat the process on the part of the list that has not been eliminated.
2220

23-
If the keys match, then a matching element has been found and its index,
24-
or position, is returned.
21+
Here's an example:
2522

26-
Otherwise, if the search key is less than the middle element's key, then
27-
the algorithm repeats its action on the sub-array to the left of the
28-
middle element or, if the search key is greater, on the sub-array to the
29-
right.
23+
Let's say we're looking for the number 23 in the following sorted list: `[4, 8, 12, 16, 23, 28, 32]`.
3024

31-
If the remaining array to be searched is empty, then the key cannot be
32-
found in the array and a special "not found" indication is returned.
33-
34-
A binary search halves the number of items to check with each iteration,
35-
so locating an item (or determining its absence) takes logarithmic time.
36-
A binary search is a dichotomic divide and conquer search algorithm.
25+
- We start by comparing 23 with the middle element, 16.
26+
- Since 23 is greater than 16, we can eliminate the left half of the list, leaving us with `[23, 28, 32]`.
27+
- We then compare 23 with the new middle element, 28.
28+
- Since 23 is less than 28, we can eliminate the right half of the list: `[23]`.
29+
- We've found our item.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Introduction
2+
3+
You have stumbled upon a group of mathematicians who are also singer-songwriters.
4+
They have written a song for each of their favorite numbers, and, as you can imagine, they have a lot of favorite numbers (like [0][zero] or [73][seventy-three] or [6174][kaprekars-constant]).
5+
6+
You are curious to hear the song for your favorite number, but with so many songs to wade through, finding the right song could take a while.
7+
Fortunately, they have organized their songs in a playlist sorted by the title — which is simply the number that the song is about.
8+
9+
You realize that you can use a binary search algorithm to quickly find a song given the title.
10+
11+
[zero]: https://en.wikipedia.org/wiki/0
12+
[seventy-three]: https://en.wikipedia.org/wiki/73_(number)
13+
[kaprekars-constant]: https://en.wikipedia.org/wiki/6174_(number)

0 commit comments

Comments
 (0)