You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: exercises/practice/binary-search-tree/.docs/instructions.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,29 +19,52 @@ All data in the left subtree is less than or equal to the current node's data, a
19
19
20
20
For example, if we had a node containing the data 4, and we added the data 2, our tree would look like this:
21
21
22
+

23
+
24
+
```text
22
25
4
23
26
/
24
27
2
28
+
```
25
29
26
30
If we then added 6, it would look like this:
27
31
32
+

33
+
34
+
```text
28
35
4
29
36
/ \
30
37
2 6
38
+
```
31
39
32
40
If we then added 3, it would look like this
33
41
42
+

43
+
44
+
```text
34
45
4
35
46
/ \
36
47
2 6
37
48
\
38
49
3
50
+
```
39
51
40
52
And if we then added 1, 5, and 7, it would look like this
41
53
54
+

55
+
56
+
```text
42
57
4
43
58
/ \
44
59
/ \
45
60
2 6
46
61
/ \ / \
47
62
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.
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].
4
4
5
5
The number will be provided as a string.
6
6
@@ -10,54 +10,59 @@ Strings of length 1 or less are not valid.
10
10
Spaces are allowed in the input, but they should be stripped before checking.
11
11
All other non-digit characters are disallowed.
12
12
13
-
### Example 1: valid credit card number
13
+
##Examples
14
14
15
-
```text
16
-
4539 3195 0343 6467
17
-
```
15
+
### Valid credit card number
18
16
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.
21
20
22
21
```text
23
22
4539 3195 0343 6467
24
23
↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ (double these)
25
24
```
26
25
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:
29
28
30
29
```text
31
30
8569 6195 0383 3437
32
31
```
33
32
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.
Copy file name to clipboardExpand all lines: exercises/practice/luhn/.docs/introduction.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,10 @@
2
2
3
3
At the Global Verification Authority, you've just been entrusted with a critical assignment.
4
4
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.
6
6
7
7
A batch of identifiers has just arrived on your desk.
8
8
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.
10
10
11
11
Can you ensure this is done right? The integrity of many services depends on you.
Copy file name to clipboardExpand all lines: exercises/practice/phone-number/.docs/instructions.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Instructions
2
2
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.
4
4
5
5
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.
6
6
All NANP-countries share the same international country code: `1`.
There are 64 codons which in turn correspond to 20 amino acids; however, all of the codon sequences and resulting amino acids are not important in this exercise.
15
-
If it works for one codon, the program should work for all of them.
16
-
However, feel free to expand the list in the test suite to include them all.
17
-
18
-
There are also three terminating codons (also known as 'STOP' codons); if any of these codons are encountered (by the ribosome), all translation ends and the protein is terminated.
19
-
20
-
All subsequent codons after are ignored, like this:
Copy file name to clipboardExpand all lines: exercises/practice/triangle/.docs/instructions.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,12 @@ A _scalene_ triangle has all sides of different lengths.
13
13
14
14
For a shape to be a triangle at all, all sides have to be of length > 0, and the sum of the lengths of any two sides must be greater than or equal to the length of the third side.
15
15
16
+
~~~~exercism/note
17
+
_Degenerate triangles_ are triangles where the sum of the length of two sides is **equal** to the length of the third side, e.g. `1, 1, 2`.
18
+
We opted to not include tests for degenerate triangles in this exercise.
19
+
You may handle those situations if you wish to do so, or safely ignore them.
0 commit comments