Skip to content

Commit f890ddd

Browse files
authored
Merge branch 'exercism:main' into update-wordy-approaches
2 parents d0627e4 + f0125e4 commit f890ddd

File tree

15 files changed

+123
-117
lines changed

15 files changed

+123
-117
lines changed

exercises/practice/binary-search-tree/.docs/instructions.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,52 @@ All data in the left subtree is less than or equal to the current node's data, a
1919

2020
For example, if we had a node containing the data 4, and we added the data 2, our tree would look like this:
2121

22+
![A graph with root node 4 and a single child node 2.](https://assets.exercism.org/images/exercises/binary-search-tree/tree-4-2.svg)
23+
24+
```text
2225
4
2326
/
2427
2
28+
```
2529

2630
If we then added 6, it would look like this:
2731

32+
![A graph with root node 4 and two child nodes 2 and 6.](https://assets.exercism.org/images/exercises/binary-search-tree/tree-4-2-6.svg)
33+
34+
```text
2835
4
2936
/ \
3037
2 6
38+
```
3139

3240
If we then added 3, it would look like this
3341

42+
![A graph with root node 4, two child nodes 2 and 6, and a grandchild node 3.](https://assets.exercism.org/images/exercises/binary-search-tree/tree-4-2-6-3.svg)
43+
44+
```text
3445
4
3546
/ \
3647
2 6
3748
\
3849
3
50+
```
3951

4052
And if we then added 1, 5, and 7, it would look like this
4153

54+
![A graph with root node 4, two child nodes 2 and 6, and four grandchild nodes 1, 3, 5 and 7.](https://assets.exercism.org/images/exercises/binary-search-tree/tree-4-2-6-1-3-5-7.svg)
55+
56+
```text
4257
4
4358
/ \
4459
/ \
4560
2 6
4661
/ \ / \
4762
1 3 5 7
63+
```
64+
65+
## Credit
66+
67+
The images were created by [habere-et-dispertire][habere-et-dispertire] using [PGF/TikZ][pgf-tikz] by Till Tantau.
68+
69+
[habere-et-dispertire]: https://exercism.org/profiles/habere-et-dispertire
70+
[pgf-tikz]: https://en.wikipedia.org/wiki/PGF/TikZ

exercises/practice/crypto-square/.meta/tests.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@ description = "8 character plaintext results in 3 chunks, the last one with a tr
3232

3333
[fbcb0c6d-4c39-4a31-83f6-c473baa6af80]
3434
description = "54 character plaintext results in 7 chunks, the last two with trailing spaces"
35+
include = false
36+
37+
[33fd914e-fa44-445b-8f38-ff8fbc9fe6e6]
38+
description = "54 character plaintext results in 8 chunks, the last two with trailing spaces"
39+
reimplements = "fbcb0c6d-4c39-4a31-83f6-c473baa6af80"

exercises/practice/crypto-square/crypto_square_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These tests are auto-generated with test data from:
22
# https://github.com/exercism/problem-specifications/tree/main/exercises/crypto-square/canonical-data.json
3-
# File last updated on 2023-07-19
3+
# File last updated on 2025-06-20
44

55
import unittest
66

@@ -47,7 +47,7 @@ def test_8_character_plaintext_results_in_3_chunks_the_last_one_with_a_trailing_
4747
expected = "clu hlt io "
4848
self.assertEqual(cipher_text(value), expected)
4949

50-
def test_54_character_plaintext_results_in_7_chunks_the_last_two_with_trailing_spaces(
50+
def test_54_character_plaintext_results_in_8_chunks_the_last_two_with_trailing_spaces(
5151
self,
5252
):
5353
value = "If man was meant to stay on the ground, god would have given us roots."

exercises/practice/dot-dsl/.docs/instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Write a Domain Specific Language similar to the Graphviz dot language.
2222
Our DSL is similar to the Graphviz dot language in that our DSL will be used to create graph data structures.
2323
However, unlike the DOT Language, our DSL will be an internal DSL for use only in our language.
2424

25-
More information about the difference between internal and external DSLs can be found [here][fowler-dsl].
25+
[Learn more about the difference between internal and external DSLs][fowler-dsl].
2626

2727
[dsl]: https://en.wikipedia.org/wiki/Domain-specific_language
2828
[dot-language]: https://en.wikipedia.org/wiki/DOT_(graph_description_language)

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

exercises/practice/largest-series-product/.meta/example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
def slices(series, size):
66

77
if not size <= len(series):
8-
raise ValueError('span must be smaller than string length')
8+
raise ValueError('span must not exceed string length')
99
elif not 0 < size:
1010
raise ValueError('span must not be negative')
1111
elif not all(item.isdigit() for item in series):
@@ -20,4 +20,4 @@ def slices(series, size):
2020
def largest_product(series, size):
2121
if size == 0:
2222
return 1
23-
return max(reduce(mul, slice) for slice in slices(series, size))
23+
return max(reduce(mul, slice) for slice in slices(series, size))

exercises/practice/largest-series-product/.meta/tests.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ description = "reports zero if all spans include zero"
3838

3939
[5d81aaf7-4f67-4125-bf33-11493cc7eab7]
4040
description = "rejects span longer than string length"
41+
include = false
42+
43+
[0ae1ce53-d9ba-41bb-827f-2fceb64f058b]
44+
description = "rejects span longer than string length"
45+
reimplements = "5d81aaf7-4f67-4125-bf33-11493cc7eab7"
4146

4247
[06bc8b90-0c51-4c54-ac22-3ec3893a079e]
4348
description = "reports 1 for empty string and empty product (0 span)"
@@ -49,6 +54,11 @@ include = false
4954

5055
[6d96c691-4374-4404-80ee-2ea8f3613dd4]
5156
description = "rejects empty string and nonzero span"
57+
include = false
58+
59+
[6cf66098-a6af-4223-aab1-26aeeefc7402]
60+
description = "rejects empty string and nonzero span"
61+
reimplements = "6d96c691-4374-4404-80ee-2ea8f3613dd4"
5262

5363
[7a38f2d6-3c35-45f6-8d6f-12e6e32d4d74]
5464
description = "rejects invalid character in digits"

exercises/practice/largest-series-product/largest_series_product_test.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These tests are auto-generated with test data from:
22
# https://github.com/exercism/problem-specifications/tree/main/exercises/largest-series-product/canonical-data.json
3-
# File last updated on 2023-07-19
3+
# File last updated on 2025-06-20
44

55
import unittest
66

@@ -44,17 +44,13 @@ def test_rejects_span_longer_than_string_length(self):
4444
with self.assertRaises(ValueError) as err:
4545
largest_product("123", 4)
4646
self.assertEqual(type(err.exception), ValueError)
47-
self.assertEqual(
48-
err.exception.args[0], "span must be smaller than string length"
49-
)
47+
self.assertEqual(err.exception.args[0], "span must not exceed string length")
5048

5149
def test_rejects_empty_string_and_nonzero_span(self):
5250
with self.assertRaises(ValueError) as err:
5351
largest_product("", 1)
5452
self.assertEqual(type(err.exception), ValueError)
55-
self.assertEqual(
56-
err.exception.args[0], "span must be smaller than string length"
57-
)
53+
self.assertEqual(err.exception.args[0], "span must not exceed string length")
5854

5955
def test_rejects_invalid_character_in_digits(self):
6056
with self.assertRaises(ValueError) as err:
Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Instructions
22

3-
Determine whether a credit card number is valid according to the [Luhn formula][luhn].
3+
Determine whether a number is valid according to the [Luhn formula][luhn].
44

55
The number will be provided as a string.
66

@@ -10,54 +10,59 @@ Strings of length 1 or less are not valid.
1010
Spaces are allowed in the input, but they should be stripped before checking.
1111
All other non-digit characters are disallowed.
1212

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

15-
```text
16-
4539 3195 0343 6467
17-
```
15+
### Valid credit card number
1816

19-
The first step of the Luhn algorithm is to double every second digit, starting from the right.
20-
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.
2120

2221
```text
2322
4539 3195 0343 6467
2423
↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ (double these)
2524
```
2625

27-
If doubling the number results in a number greater than 9 then subtract 9 from the product.
28-
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:
2928

3029
```text
3130
8569 6195 0383 3437
3231
```
3332

34-
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.
3535

3636
```text
37-
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
3838
```
3939

40-
If the sum is evenly divisible by 10, then the number is valid.
41-
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`.
4245

43-
### 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.
4447

4548
```text
46-
8273 1232 7352 0569
49+
066 123 478
50+
↑ ↑ ↑ ↑ (double these)
4751
```
4852

49-
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:
5055

5156
```text
52-
7253 2262 5312 0539
57+
036 226 458
5358
```
5459

55-
Sum the digits
60+
We sum the digits:
5661

5762
```text
58-
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
5964
```
6065

61-
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!
6267

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

exercises/practice/luhn/.docs/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
At the Global Verification Authority, you've just been entrusted with a critical assignment.
44
Across the city, from online purchases to secure logins, countless operations rely on the accuracy of numerical identifiers like credit card numbers, bank account numbers, transaction codes, and tracking IDs.
5-
The Luhn algorithm is a simple checksum formula used to ensure these numbers are valid and error-free.
5+
The Luhn algorithm is a simple checksum formula used to help identify mistyped numbers.
66

77
A batch of identifiers has just arrived on your desk.
88
All of them must pass the Luhn test to ensure they're legitimate.
9-
If any fail, they'll be flagged as invalid, preventing errors or fraud, such as incorrect transactions or unauthorized access.
9+
If any fail, they'll be flagged as invalid, preventing mistakes such as incorrect transactions or failed account verifications.
1010

1111
Can you ensure this is done right? The integrity of many services depends on you.

0 commit comments

Comments
 (0)