Skip to content

Commit 0edb523

Browse files
authored
Sync docs and metadata (#280)
1 parent 3c134f1 commit 0edb523

File tree

10 files changed

+115
-49
lines changed

10 files changed

+115
-49
lines changed
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/eliuds-eggs/.docs/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The position information encoding is calculated as follows:
5858

5959
### Decimal number on the display
6060

61-
16
61+
8
6262

6363
### Actual eggs in the coop
6464

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# Instructions
22

3-
Take a nested list and return a single flattened list with all values except nil/null.
3+
Take a nested array of any depth and return a fully flattened array.
44

5-
The challenge is to take an arbitrarily-deep nested list-like structure and produce a flattened structure without any nil/null values.
5+
Note that some language tracks may include null-like values in the input array, and the way these values are represented varies by track.
6+
Such values should be excluded from the flattened array.
67

7-
For example:
8+
Additionally, the input may be of a different data type and contain different types, depending on the track.
89

9-
input: [1,[2,3,null,4],[null],5]
10+
Check the test suite for details.
1011

11-
output: [1,2,3,4,5]
12+
## Example
13+
14+
input: `[1, [2, 6, null], [[null, [4]], 5]]`
15+
16+
output: `[1, 2, 6, 4, 5]`

exercises/practice/leap/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
},
1616
"blurb": "Determine whether a given year is a leap year.",
1717
"source": "CodeRanch Cattle Drive, Assignment 3",
18-
"source_url": "https://coderanch.com/t/718816/Leap"
18+
"source_url": "https://web.archive.org/web/20240907033714/https://coderanch.com/t/718816/Leap"
1919
}
Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,68 @@
11
# Instructions
22

3-
Given a number determine whether or not it is valid per the Luhn formula.
3+
Determine whether a number is valid according to the [Luhn formula][luhn].
44

5-
The [Luhn algorithm][luhn] is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers and Canadian Social Insurance Numbers.
5+
The number will be provided as a string.
66

7-
The task is to check if a given string is valid.
8-
9-
## Validating a Number
7+
## Validating a number
108

119
Strings of length 1 or less are not valid.
1210
Spaces are allowed in the input, but they should be stripped before checking.
1311
All other non-digit characters are disallowed.
1412

15-
### Example 1: valid credit card number
13+
## Examples
1614

17-
```text
18-
4539 3195 0343 6467
19-
```
15+
### Valid credit card number
2016

21-
The first step of the Luhn algorithm is to double every second digit, starting from the right.
22-
We will be doubling
17+
The number to be checked is `4539 3195 0343 6467`.
18+
19+
The first step of the Luhn algorithm is to start at the end of the number and double every second digit, beginning with the second digit from the right and moving left.
2320

2421
```text
2522
4539 3195 0343 6467
2623
↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ (double these)
2724
```
2825

29-
If doubling the number results in a number greater than 9 then subtract 9 from the product.
30-
The results of our doubling:
26+
If the result of doubling a digit is greater than 9, we subtract 9 from that result.
27+
We end up with:
3128

3229
```text
3330
8569 6195 0383 3437
3431
```
3532

36-
Then sum all of the digits:
33+
Finally, we sum all digits.
34+
If the sum is evenly divisible by 10, the original number is valid.
3735

3836
```text
39-
8+5+6+9+6+1+9+5+0+3+8+3+3+4+3+7 = 80
37+
8 + 5 + 6 + 9 + 6 + 1 + 9 + 5 + 0 + 3 + 8 + 3 + 3 + 4 + 3 + 7 = 80
4038
```
4139

42-
If the sum is evenly divisible by 10, then the number is valid.
43-
This number is valid!
40+
80 is evenly divisible by 10, so number `4539 3195 0343 6467` is valid!
41+
42+
### Invalid Canadian SIN
43+
44+
The number to be checked is `066 123 468`.
4445

45-
### Example 2: invalid credit card number
46+
We start at the end of the number and double every second digit, beginning with the second digit from the right and moving left.
4647

4748
```text
48-
8273 1232 7352 0569
49+
066 123 478
50+
↑ ↑ ↑ ↑ (double these)
4951
```
5052

51-
Double the second digits, starting from the right
53+
If the result of doubling a digit is greater than 9, we subtract 9 from that result.
54+
We end up with:
5255

5356
```text
54-
7253 2262 5312 0539
57+
036 226 458
5558
```
5659

57-
Sum the digits
60+
We sum the digits:
5861

5962
```text
60-
7+2+5+3+2+2+6+2+5+3+1+2+0+5+3+9 = 57
63+
0 + 3 + 6 + 2 + 2 + 6 + 4 + 5 + 8 = 36
6164
```
6265

63-
57 is not evenly divisible by 10, so this number is not valid.
66+
36 is not evenly divisible by 10, so number `066 123 478` is not valid!
6467

6568
[luhn]: https://en.wikipedia.org/wiki/Luhn_algorithm

exercises/practice/meetup/.docs/instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Your task is to find the exact date of a meetup, given a month, year, weekday and week.
44

5-
There are five week values to consider: `first`, `second`, `third`, `fourth`, `last`, `teenth`.
5+
There are six week values to consider: `first`, `second`, `third`, `fourth`, `last`, `teenth`.
66

77
For example, you might be asked to find the date for the meetup on the first Monday in January 2018 (January 1, 2018).
88

exercises/practice/pascals-triangle/.docs/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Over the next hour, your teacher reveals some amazing things hidden in this tria
1313
- It contains the Fibonacci sequence.
1414
- If you color odd and even numbers differently, you get a beautiful pattern called the [Sierpiński triangle][wikipedia-sierpinski-triangle].
1515

16-
The teacher implores you and your classmates to lookup other uses, and assures you that there are lots more!
16+
The teacher implores you and your classmates to look up other uses, and assures you that there are lots more!
1717
At that moment, the school bell rings.
1818
You realize that for the past hour, you were completely absorbed in learning about Pascal's triangle.
1919
You quickly grab your laptop from your bag and go outside, ready to enjoy both the sunshine _and_ the wonders of Pascal's triangle.

exercises/practice/phone-number/.docs/instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Instructions
22

3-
Clean up user-entered phone numbers so that they can be sent SMS messages.
3+
Clean up phone numbers so that they can be sent SMS messages.
44

55
The **North American Numbering Plan (NANP)** is a telephone numbering system used by many countries in North America like the United States, Canada or Bermuda.
66
All NANP-countries share the same international country code: `1`.

exercises/practice/rna-transcription/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
".meta/example.jq"
1414
]
1515
},
16-
"blurb": "Given a DNA strand, return its RNA Complement Transcription.",
16+
"blurb": "Given a DNA strand, return its RNA complement.",
1717
"source": "Hyperphysics",
1818
"source_url": "https://web.archive.org/web/20220408112140/http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html"
1919
}

exercises/practice/sieve/.docs/instructions.md

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,96 @@ A prime number is a number larger than 1 that is only divisible by 1 and itself.
66
For example, 2, 3, 5, 7, 11, and 13 are prime numbers.
77
By contrast, 6 is _not_ a prime number as it not only divisible by 1 and itself, but also by 2 and 3.
88

9-
To use the Sieve of Eratosthenes, you first create a list of all the numbers between 2 and your given number.
10-
Then you repeat the following steps:
9+
To use the Sieve of Eratosthenes, first, write out all the numbers from 2 up to and including your given number.
10+
Then, follow these steps:
1111

12-
1. Find the next unmarked number in your list (skipping over marked numbers).
12+
1. Find the next unmarked number (skipping over marked numbers).
1313
This is a prime number.
1414
2. Mark all the multiples of that prime number as **not** prime.
1515

16-
You keep repeating these steps until you've gone through every number in your list.
16+
Repeat the steps until you've gone through every number.
1717
At the end, all the unmarked numbers are prime.
1818

1919
~~~~exercism/note
20-
The tests don't check that you've implemented the algorithm, only that you've come up with the correct list of primes.
21-
To check you are implementing the Sieve correctly, a good first test is to check that you do not use division or remainder operations.
20+
The Sieve of Eratosthenes marks off multiples of each prime using addition (repeatedly adding the prime) or multiplication (directly computing its multiples), rather than checking each number for divisibility.
21+
22+
The tests don't check that you've implemented the algorithm, only that you've come up with the correct primes.
2223
~~~~
2324

2425
## Example
2526

2627
Let's say you're finding the primes less than or equal to 10.
2728

28-
- List out 2, 3, 4, 5, 6, 7, 8, 9, 10, leaving them all unmarked.
29+
- Write out 2, 3, 4, 5, 6, 7, 8, 9, 10, leaving them all unmarked.
30+
31+
```text
32+
2 3 4 5 6 7 8 9 10
33+
```
34+
2935
- 2 is unmarked and is therefore a prime.
3036
Mark 4, 6, 8 and 10 as "not prime".
37+
38+
```text
39+
2 3 [4] 5 [6] 7 [8] 9 [10]
40+
41+
```
42+
3143
- 3 is unmarked and is therefore a prime.
3244
Mark 6 and 9 as not prime _(marking 6 is optional - as it's already been marked)_.
45+
46+
```text
47+
2 3 [4] 5 [6] 7 [8] [9] [10]
48+
49+
```
50+
3351
- 4 is marked as "not prime", so we skip over it.
52+
53+
```text
54+
2 3 [4] 5 [6] 7 [8] [9] [10]
55+
56+
```
57+
3458
- 5 is unmarked and is therefore a prime.
3559
Mark 10 as not prime _(optional - as it's already been marked)_.
60+
61+
```text
62+
2 3 [4] 5 [6] 7 [8] [9] [10]
63+
64+
```
65+
3666
- 6 is marked as "not prime", so we skip over it.
67+
68+
```text
69+
2 3 [4] 5 [6] 7 [8] [9] [10]
70+
71+
```
72+
3773
- 7 is unmarked and is therefore a prime.
74+
75+
```text
76+
2 3 [4] 5 [6] 7 [8] [9] [10]
77+
78+
```
79+
3880
- 8 is marked as "not prime", so we skip over it.
81+
82+
```text
83+
2 3 [4] 5 [6] 7 [8] [9] [10]
84+
85+
```
86+
3987
- 9 is marked as "not prime", so we skip over it.
88+
89+
```text
90+
2 3 [4] 5 [6] 7 [8] [9] [10]
91+
92+
```
93+
4094
- 10 is marked as "not prime", so we stop as there are no more numbers to check.
4195

42-
You've examined all numbers and found 2, 3, 5, and 7 are still unmarked, which means they're the primes less than or equal to 10.
96+
```text
97+
2 3 [4] 5 [6] 7 [8] [9] [10]
98+
99+
```
100+
101+
You've examined all the numbers and found that 2, 3, 5, and 7 are still unmarked, meaning they're the primes less than or equal to 10.

0 commit comments

Comments
 (0)