configlet sync for docs and metadata (#285)

* configlet sync for docs and metadata

* configlet sync for docs and metadata

---------

Co-authored-by: Marc Bernard <59966492+mbtools@users.noreply.github.com>
This commit is contained in:
András B Nagy
2024-01-02 21:52:42 -08:00
committed by GitHub
parent 7f0d7939d0
commit 2d14992ec9
59 changed files with 544 additions and 272 deletions

View File

@@ -1,4 +1,4 @@
# Description # Instructions
Convert a phrase to its acronym. Convert a phrase to its acronym.
@@ -10,8 +10,8 @@ Punctuation is handled as follows: hyphens are word separators (like whitespace)
For example: For example:
|Input|Output| | Input | Output |
|-|-| | ------------------------- | ------ |
|As Soon As Possible|ASAP| | As Soon As Possible | ASAP |
|Liquid-crystal display|LCD| | Liquid-crystal display | LCD |
|Thank George It's Friday!|TGIF| | Thank George It's Friday! | TGIF |

View File

@@ -14,5 +14,6 @@
] ]
}, },
"blurb": "Convert a long phrase to its acronym.", "blurb": "Convert a long phrase to its acronym.",
"source_url": "https://github.com/monkbroc" "source_url": "https://github.com/monkbroc",
"source": "Julien Vanier"
} }

View File

@@ -1,4 +1,4 @@
# Description # Instructions
Create an implementation of the affine cipher, an ancient encryption system created in the Middle East. Create an implementation of the affine cipher, an ancient encryption system created in the Middle East.
@@ -6,7 +6,7 @@ The affine cipher is a type of monoalphabetic substitution cipher.
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. 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.
Although all monoalphabetic ciphers are weak, the affine cipher is much stronger than the atbash cipher, because it has many more keys. Although all monoalphabetic ciphers are weak, the affine cipher is much stronger than the atbash cipher, because it has many more keys.
[comment]: # ( monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic ) [//]: # " monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic "
## Encryption ## Encryption
@@ -23,7 +23,7 @@ Where:
For the Roman alphabet `m` is `26`. For the Roman alphabet `m` is `26`.
- `a` and `b` are integers which make the encryption key - `a` and `b` are integers which make the encryption key
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]). 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]).
In case `a` is not coprime to `m`, your program should indicate that this is an error. In case `a` is not coprime to `m`, your program should indicate that this is an error.
Otherwise it should encrypt or decrypt with the provided key. Otherwise it should encrypt or decrypt with the provided key.

View File

@@ -15,5 +15,5 @@
}, },
"blurb": "Create an implementation of the Affine cipher, an ancient encryption algorithm from the Middle East.", "blurb": "Create an implementation of the Affine cipher, an ancient encryption algorithm from the Middle East.",
"source": "Wikipedia", "source": "Wikipedia",
"source_url": "http://en.wikipedia.org/wiki/Affine_cipher" "source_url": "https://en.wikipedia.org/wiki/Affine_cipher"
} }

View File

@@ -1,8 +1,13 @@
# Description # Instructions
An anagram is a rearrangement of letters to form a new word. An anagram is a rearrangement of letters to form a new word: for example `"owns"` is an anagram of `"snow"`.
Given a word and a list of candidates, select the sublist of anagrams of the given word. A word is not its own anagram: for example, `"stop"` is not an anagram of `"stop"`.
Given `"listen"` and a list of candidates like `"enlists" "google" Given a target word and a set of candidate words, this exercise requests the anagram set: the subset of the candidates that are anagrams of the target.
"inlets" "banana"` the program should return a list containing
`"inlets"`. The target and candidates are words of one or more ASCII alphabetic characters (`A`-`Z` and `a`-`z`).
Lowercase and uppercase characters are equivalent: for example, `"PoTS"` is an anagram of `"sTOp"`, but `StoP` is not an anagram of `sTOp`.
The anagram set is the subset of the candidate set that are anagrams of the target (in any order).
Words in the anagram set should have the same letter case as in the candidate set.
Given the target `"stone"` and candidates `"stone"`, `"tones"`, `"banana"`, `"tons"`, `"notes"`, `"Seton"`, the anagram set is `"tones"`, `"notes"`, `"Seton"`.

View File

@@ -14,5 +14,6 @@
] ]
}, },
"blurb": "Given a word and a list of possible anagrams, select the correct sublist.", "blurb": "Given a word and a list of possible anagrams, select the correct sublist.",
"source_url": "https://github.com/rchatley/extreme_startup" "source_url": "https://github.com/rchatley/extreme_startup",
"source": "Inspired by the Extreme Startup game"
} }

View File

@@ -1,13 +1,13 @@
# Description # Instructions
An [Armstrong number][armstrong-number] is a number that is the sum of its own digits each raised to the power of the number of digits. An [Armstrong number][armstrong-number] is a number that is the sum of its own digits each raised to the power of the number of digits.
For example: For example:
- 9 is an Armstrong number, because `9 = 9^1 = 9` - 9 is an Armstrong number, because `9 = 9^1 = 9`
- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1` - 10 is _not_ an Armstrong number, because `10 != 1^2 + 0^2 = 1`
- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153` - 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190` - 154 is _not_ an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
Write some code to determine whether a number is an Armstrong number. Write some code to determine whether a number is an Armstrong number.

View File

@@ -14,5 +14,6 @@
] ]
}, },
"blurb": "Determine if a number is an Armstrong number.", "blurb": "Determine if a number is an Armstrong number.",
"source_url": "https://en.wikipedia.org/wiki/Narcissistic_number" "source_url": "https://en.wikipedia.org/wiki/Narcissistic_number",
"source": "Wikipedia"
} }

View File

@@ -1,11 +1,9 @@
# Description # Instructions
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East. Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
The Atbash cipher is a simple substitution cipher that relies on 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.
transposing all the letters in the alphabet such that the resulting The first letter is replaced with the last letter, the second with the second-last, and so on.
alphabet is backwards. The first letter is replaced with the last
letter, the second with the second-last, and so on.
An Atbash cipher for the Latin alphabet would be as follows: An Atbash cipher for the Latin alphabet would be as follows:
@@ -14,16 +12,16 @@ Plain: abcdefghijklmnopqrstuvwxyz
Cipher: zyxwvutsrqponmlkjihgfedcba Cipher: zyxwvutsrqponmlkjihgfedcba
``` ```
It is a very weak cipher because it only has one possible key, and it is It is a very weak cipher because it only has one possible key, and it is a simple mono-alphabetic substitution cipher.
a simple mono-alphabetic substitution cipher. However, this may not have However, this may not have been an issue in the cipher's time.
been an issue in the cipher's time.
Ciphertext is written out in groups of fixed length, the traditional group size Ciphertext is written out in groups of fixed length, the traditional group size being 5 letters, leaving numbers unchanged, and punctuation is excluded.
being 5 letters, and punctuation is excluded. This is to make it harder to guess This is to make it harder to guess things based on word boundaries.
things based on word boundaries. All text will be encoded as lowercase letters.
## Examples ## Examples
- Encoding `test` gives `gvhg` - Encoding `test` gives `gvhg`
- Encoding `x123 yes` gives `c123b vh`
- Decoding `gvhg` gives `test` - Decoding `gvhg` gives `test`
- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog` - Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog`

View File

@@ -15,5 +15,5 @@
}, },
"blurb": "Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.", "blurb": "Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.",
"source": "Wikipedia", "source": "Wikipedia",
"source_url": "http://en.wikipedia.org/wiki/Atbash" "source_url": "https://en.wikipedia.org/wiki/Atbash"
} }

View File

@@ -14,7 +14,284 @@ Take one down and pass it around, 97 bottles of beer on the wall.
97 bottles of beer on the wall, 97 bottles of beer. 97 bottles of beer on the wall, 97 bottles of beer.
Take one down and pass it around, 96 bottles of beer on the wall. Take one down and pass it around, 96 bottles of beer on the wall.
... 96 bottles of beer on the wall, 96 bottles of beer.
Take one down and pass it around, 95 bottles of beer on the wall.
95 bottles of beer on the wall, 95 bottles of beer.
Take one down and pass it around, 94 bottles of beer on the wall.
94 bottles of beer on the wall, 94 bottles of beer.
Take one down and pass it around, 93 bottles of beer on the wall.
93 bottles of beer on the wall, 93 bottles of beer.
Take one down and pass it around, 92 bottles of beer on the wall.
92 bottles of beer on the wall, 92 bottles of beer.
Take one down and pass it around, 91 bottles of beer on the wall.
91 bottles of beer on the wall, 91 bottles of beer.
Take one down and pass it around, 90 bottles of beer on the wall.
90 bottles of beer on the wall, 90 bottles of beer.
Take one down and pass it around, 89 bottles of beer on the wall.
89 bottles of beer on the wall, 89 bottles of beer.
Take one down and pass it around, 88 bottles of beer on the wall.
88 bottles of beer on the wall, 88 bottles of beer.
Take one down and pass it around, 87 bottles of beer on the wall.
87 bottles of beer on the wall, 87 bottles of beer.
Take one down and pass it around, 86 bottles of beer on the wall.
86 bottles of beer on the wall, 86 bottles of beer.
Take one down and pass it around, 85 bottles of beer on the wall.
85 bottles of beer on the wall, 85 bottles of beer.
Take one down and pass it around, 84 bottles of beer on the wall.
84 bottles of beer on the wall, 84 bottles of beer.
Take one down and pass it around, 83 bottles of beer on the wall.
83 bottles of beer on the wall, 83 bottles of beer.
Take one down and pass it around, 82 bottles of beer on the wall.
82 bottles of beer on the wall, 82 bottles of beer.
Take one down and pass it around, 81 bottles of beer on the wall.
81 bottles of beer on the wall, 81 bottles of beer.
Take one down and pass it around, 80 bottles of beer on the wall.
80 bottles of beer on the wall, 80 bottles of beer.
Take one down and pass it around, 79 bottles of beer on the wall.
79 bottles of beer on the wall, 79 bottles of beer.
Take one down and pass it around, 78 bottles of beer on the wall.
78 bottles of beer on the wall, 78 bottles of beer.
Take one down and pass it around, 77 bottles of beer on the wall.
77 bottles of beer on the wall, 77 bottles of beer.
Take one down and pass it around, 76 bottles of beer on the wall.
76 bottles of beer on the wall, 76 bottles of beer.
Take one down and pass it around, 75 bottles of beer on the wall.
75 bottles of beer on the wall, 75 bottles of beer.
Take one down and pass it around, 74 bottles of beer on the wall.
74 bottles of beer on the wall, 74 bottles of beer.
Take one down and pass it around, 73 bottles of beer on the wall.
73 bottles of beer on the wall, 73 bottles of beer.
Take one down and pass it around, 72 bottles of beer on the wall.
72 bottles of beer on the wall, 72 bottles of beer.
Take one down and pass it around, 71 bottles of beer on the wall.
71 bottles of beer on the wall, 71 bottles of beer.
Take one down and pass it around, 70 bottles of beer on the wall.
70 bottles of beer on the wall, 70 bottles of beer.
Take one down and pass it around, 69 bottles of beer on the wall.
69 bottles of beer on the wall, 69 bottles of beer.
Take one down and pass it around, 68 bottles of beer on the wall.
68 bottles of beer on the wall, 68 bottles of beer.
Take one down and pass it around, 67 bottles of beer on the wall.
67 bottles of beer on the wall, 67 bottles of beer.
Take one down and pass it around, 66 bottles of beer on the wall.
66 bottles of beer on the wall, 66 bottles of beer.
Take one down and pass it around, 65 bottles of beer on the wall.
65 bottles of beer on the wall, 65 bottles of beer.
Take one down and pass it around, 64 bottles of beer on the wall.
64 bottles of beer on the wall, 64 bottles of beer.
Take one down and pass it around, 63 bottles of beer on the wall.
63 bottles of beer on the wall, 63 bottles of beer.
Take one down and pass it around, 62 bottles of beer on the wall.
62 bottles of beer on the wall, 62 bottles of beer.
Take one down and pass it around, 61 bottles of beer on the wall.
61 bottles of beer on the wall, 61 bottles of beer.
Take one down and pass it around, 60 bottles of beer on the wall.
60 bottles of beer on the wall, 60 bottles of beer.
Take one down and pass it around, 59 bottles of beer on the wall.
59 bottles of beer on the wall, 59 bottles of beer.
Take one down and pass it around, 58 bottles of beer on the wall.
58 bottles of beer on the wall, 58 bottles of beer.
Take one down and pass it around, 57 bottles of beer on the wall.
57 bottles of beer on the wall, 57 bottles of beer.
Take one down and pass it around, 56 bottles of beer on the wall.
56 bottles of beer on the wall, 56 bottles of beer.
Take one down and pass it around, 55 bottles of beer on the wall.
55 bottles of beer on the wall, 55 bottles of beer.
Take one down and pass it around, 54 bottles of beer on the wall.
54 bottles of beer on the wall, 54 bottles of beer.
Take one down and pass it around, 53 bottles of beer on the wall.
53 bottles of beer on the wall, 53 bottles of beer.
Take one down and pass it around, 52 bottles of beer on the wall.
52 bottles of beer on the wall, 52 bottles of beer.
Take one down and pass it around, 51 bottles of beer on the wall.
51 bottles of beer on the wall, 51 bottles of beer.
Take one down and pass it around, 50 bottles of beer on the wall.
50 bottles of beer on the wall, 50 bottles of beer.
Take one down and pass it around, 49 bottles of beer on the wall.
49 bottles of beer on the wall, 49 bottles of beer.
Take one down and pass it around, 48 bottles of beer on the wall.
48 bottles of beer on the wall, 48 bottles of beer.
Take one down and pass it around, 47 bottles of beer on the wall.
47 bottles of beer on the wall, 47 bottles of beer.
Take one down and pass it around, 46 bottles of beer on the wall.
46 bottles of beer on the wall, 46 bottles of beer.
Take one down and pass it around, 45 bottles of beer on the wall.
45 bottles of beer on the wall, 45 bottles of beer.
Take one down and pass it around, 44 bottles of beer on the wall.
44 bottles of beer on the wall, 44 bottles of beer.
Take one down and pass it around, 43 bottles of beer on the wall.
43 bottles of beer on the wall, 43 bottles of beer.
Take one down and pass it around, 42 bottles of beer on the wall.
42 bottles of beer on the wall, 42 bottles of beer.
Take one down and pass it around, 41 bottles of beer on the wall.
41 bottles of beer on the wall, 41 bottles of beer.
Take one down and pass it around, 40 bottles of beer on the wall.
40 bottles of beer on the wall, 40 bottles of beer.
Take one down and pass it around, 39 bottles of beer on the wall.
39 bottles of beer on the wall, 39 bottles of beer.
Take one down and pass it around, 38 bottles of beer on the wall.
38 bottles of beer on the wall, 38 bottles of beer.
Take one down and pass it around, 37 bottles of beer on the wall.
37 bottles of beer on the wall, 37 bottles of beer.
Take one down and pass it around, 36 bottles of beer on the wall.
36 bottles of beer on the wall, 36 bottles of beer.
Take one down and pass it around, 35 bottles of beer on the wall.
35 bottles of beer on the wall, 35 bottles of beer.
Take one down and pass it around, 34 bottles of beer on the wall.
34 bottles of beer on the wall, 34 bottles of beer.
Take one down and pass it around, 33 bottles of beer on the wall.
33 bottles of beer on the wall, 33 bottles of beer.
Take one down and pass it around, 32 bottles of beer on the wall.
32 bottles of beer on the wall, 32 bottles of beer.
Take one down and pass it around, 31 bottles of beer on the wall.
31 bottles of beer on the wall, 31 bottles of beer.
Take one down and pass it around, 30 bottles of beer on the wall.
30 bottles of beer on the wall, 30 bottles of beer.
Take one down and pass it around, 29 bottles of beer on the wall.
29 bottles of beer on the wall, 29 bottles of beer.
Take one down and pass it around, 28 bottles of beer on the wall.
28 bottles of beer on the wall, 28 bottles of beer.
Take one down and pass it around, 27 bottles of beer on the wall.
27 bottles of beer on the wall, 27 bottles of beer.
Take one down and pass it around, 26 bottles of beer on the wall.
26 bottles of beer on the wall, 26 bottles of beer.
Take one down and pass it around, 25 bottles of beer on the wall.
25 bottles of beer on the wall, 25 bottles of beer.
Take one down and pass it around, 24 bottles of beer on the wall.
24 bottles of beer on the wall, 24 bottles of beer.
Take one down and pass it around, 23 bottles of beer on the wall.
23 bottles of beer on the wall, 23 bottles of beer.
Take one down and pass it around, 22 bottles of beer on the wall.
22 bottles of beer on the wall, 22 bottles of beer.
Take one down and pass it around, 21 bottles of beer on the wall.
21 bottles of beer on the wall, 21 bottles of beer.
Take one down and pass it around, 20 bottles of beer on the wall.
20 bottles of beer on the wall, 20 bottles of beer.
Take one down and pass it around, 19 bottles of beer on the wall.
19 bottles of beer on the wall, 19 bottles of beer.
Take one down and pass it around, 18 bottles of beer on the wall.
18 bottles of beer on the wall, 18 bottles of beer.
Take one down and pass it around, 17 bottles of beer on the wall.
17 bottles of beer on the wall, 17 bottles of beer.
Take one down and pass it around, 16 bottles of beer on the wall.
16 bottles of beer on the wall, 16 bottles of beer.
Take one down and pass it around, 15 bottles of beer on the wall.
15 bottles of beer on the wall, 15 bottles of beer.
Take one down and pass it around, 14 bottles of beer on the wall.
14 bottles of beer on the wall, 14 bottles of beer.
Take one down and pass it around, 13 bottles of beer on the wall.
13 bottles of beer on the wall, 13 bottles of beer.
Take one down and pass it around, 12 bottles of beer on the wall.
12 bottles of beer on the wall, 12 bottles of beer.
Take one down and pass it around, 11 bottles of beer on the wall.
11 bottles of beer on the wall, 11 bottles of beer.
Take one down and pass it around, 10 bottles of beer on the wall.
10 bottles of beer on the wall, 10 bottles of beer.
Take one down and pass it around, 9 bottles of beer on the wall.
9 bottles of beer on the wall, 9 bottles of beer.
Take one down and pass it around, 8 bottles of beer on the wall.
8 bottles of beer on the wall, 8 bottles of beer.
Take one down and pass it around, 7 bottles of beer on the wall.
7 bottles of beer on the wall, 7 bottles of beer.
Take one down and pass it around, 6 bottles of beer on the wall.
6 bottles of beer on the wall, 6 bottles of beer.
Take one down and pass it around, 5 bottles of beer on the wall.
5 bottles of beer on the wall, 5 bottles of beer.
Take one down and pass it around, 4 bottles of beer on the wall.
4 bottles of beer on the wall, 4 bottles of beer.
Take one down and pass it around, 3 bottles of beer on the wall.
3 bottles of beer on the wall, 3 bottles of beer. 3 bottles of beer on the wall, 3 bottles of beer.
Take one down and pass it around, 2 bottles of beer on the wall. Take one down and pass it around, 2 bottles of beer on the wall.
@@ -28,17 +305,3 @@ Take it down and pass it around, no more bottles of beer on the wall.
No more bottles of beer on the wall, no more bottles of beer. No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall. Go to the store and buy some more, 99 bottles of beer on the wall.
``` ```
## For bonus points
Did you get the tests passing and the code clean? If you want to, these
are some additional things you could try:
- Remove as much duplication as you possibly can.
- Optimize for readability, even if it means introducing duplication.
- If you've removed all the duplication, do you have a lot of
conditionals? Try replacing the conditionals with polymorphism, if it
applies in this language. How readable is it?
Then please share your thoughts in a comment on the submission. Did this
experiment make the code better? Worse? Did you learn anything from it?

View File

@@ -15,5 +15,5 @@
}, },
"blurb": "Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.", "blurb": "Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.",
"source": "Learn to Program by Chris Pine", "source": "Learn to Program by Chris Pine",
"source_url": "http://pine.fm/LearnToProgram/?Chapter=06" "source_url": "https://pine.fm/LearnToProgram/?Chapter=06"
} }

View File

@@ -1,12 +1,10 @@
# Instructions # Instructions
To try and encourage more sales of different books from a popular 5 book To try and encourage more sales of different books from a popular 5 book series, a bookshop has decided to offer discounts on multiple book purchases.
series, a bookshop has decided to offer discounts on multiple book purchases.
One copy of any of the five books costs $8. One copy of any of the five books costs $8.
If, however, you buy two different books, you get a 5% If, however, you buy two different books, you get a 5% discount on those two books.
discount on those two books.
If you buy 3 different books, you get a 10% discount. If you buy 3 different books, you get a 10% discount.
@@ -14,14 +12,9 @@ If you buy 4 different books, you get a 20% discount.
If you buy all 5, you get a 25% discount. If you buy all 5, you get a 25% discount.
Note: that if you buy four books, of which 3 are Note that if you buy four books, of which 3 are different titles, you get a 10% discount on the 3 that form part of a set, but the fourth book still costs $8.
different titles, you get a 10% discount on the 3 that
form part of a set, but the fourth book still costs $8.
Your mission is to write a piece of code to calculate the Your mission is to write code to calculate the price of any conceivable shopping basket (containing only books of the same series), giving as big a discount as possible.
price of any conceivable shopping basket (containing only
books of the same series), giving as big a discount as
possible.
For example, how much does this basket of books cost? For example, how much does this basket of books cost?
@@ -33,36 +26,36 @@ For example, how much does this basket of books cost?
One way of grouping these 8 books is: One way of grouping these 8 books is:
- 1 group of 5 --> 25% discount (1st,2nd,3rd,4th,5th) - 1 group of 5 (1st, 2nd,3rd, 4th, 5th)
- +1 group of 3 --> 10% discount (1st,2nd,3rd) - 1 group of 3 (1st, 2nd, 3rd)
This would give a total of: This would give a total of:
- 5 books at a 25% discount - 5 books at a 25% discount
- +3 books at a 10% discount - 3 books at a 10% discount
Resulting in: Resulting in:
- 5 × (8 - 2.00) = 5 × 6.00 = $30.00 - 5 × (100% - 25%) × $8 = 5 × $6.00 = $30.00, plus
- +3 × (8 - 0.80) = 3 × 7.20 = $21.60 - 3 × (100% - 10%) × $8 = 3 × $7.20 = $21.60
For a total of $51.60 Which equals $51.60.
However, a different way to group these 8 books is: However, a different way to group these 8 books is:
- 1 group of 4 books --> 20% discount (1st,2nd,3rd,4th) - 1 group of 4 books (1st, 2nd, 3rd, 4th)
- +1 group of 4 books --> 20% discount (1st,2nd,3rd,5th) - 1 group of 4 books (1st, 2nd, 3rd, 5th)
This would give a total of: This would give a total of:
- 4 books at a 20% discount - 4 books at a 20% discount
- +4 books at a 20% discount - 4 books at a 20% discount
Resulting in: Resulting in:
- 4 × (8 - 1.60) = 4 × 6.40 = $25.60 - 4 × (100% - 20%) × $8 = 4 × $6.40 = $25.60, plus
- +4 × (8 - 1.60) = 4 × 6.40 = $25.60 - 4 × (100% - 20%) × $8 = 4 × $6.40 = $25.60
For a total of $51.20 Which equals $51.20.
And $51.20 is the price with the biggest discount. And $51.20 is the price with the biggest discount.

View File

@@ -15,5 +15,5 @@
}, },
"blurb": "To try and encourage more sales of different books from a popular 5 book series, a bookshop has decided to offer discounts of multiple-book purchases.", "blurb": "To try and encourage more sales of different books from a popular 5 book series, a bookshop has decided to offer discounts of multiple-book purchases.",
"source": "Inspired by the harry potter kata from Cyber-Dojo.", "source": "Inspired by the harry potter kata from Cyber-Dojo.",
"source_url": "http://cyber-dojo.org" "source_url": "https://cyber-dojo.org"
} }

View File

@@ -14,6 +14,5 @@
] ]
}, },
"blurb": "Implement a clock that handles times without dates.", "blurb": "Implement a clock that handles times without dates.",
"source": "Pairing session with Erin Drummond", "source": "Pairing session with Erin Drummond"
"source_url": "https://twitter.com/ebdrummond"
} }

View File

@@ -1,4 +1,4 @@
# Description # Instructions
The Collatz Conjecture or 3x+1 problem can be summarized as follows: The Collatz Conjecture or 3x+1 problem can be summarized as follows:

View File

@@ -1,14 +1,13 @@
# Description # Instructions
Implement the classic method for composing secret messages called a square code. Implement the classic method for composing secret messages called a square code.
Given an English text, output the encoded version of that text. Given an English text, output the encoded version of that text.
First, the input is normalized: the spaces and punctuation are removed First, the input is normalized: the spaces and punctuation are removed from the English text and the message is down-cased.
from the English text and the message is down-cased.
Then, the normalized characters are broken into rows. These rows can be Then, the normalized characters are broken into rows.
regarded as forming a rectangle when printed with intervening newlines. These rows can be regarded as forming a rectangle when printed with intervening newlines.
For example, the sentence For example, the sentence
@@ -22,18 +21,16 @@ is normalized to:
"ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots" "ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots"
``` ```
The plaintext should be organized in to a rectangle. The size of the The plaintext should be organized into a rectangle as square as possible.
rectangle should be decided by the length of the message. The size of the rectangle should be decided by the length of the message.
If `c` is the number of columns and `r` is the number of rows, then for If `c` is the number of columns and `r` is the number of rows, then for the rectangle `r` x `c` find the smallest possible integer `c` such that:
the rectangle `r` x `c` find the smallest possible integer `c` such that:
- `r * c >= length(message)`, - `r * c >= length of message`,
- and `c >= r`, - and `c >= r`,
- and `c - r <= 1`. - and `c - r <= 1`.
Our normalized text is 54 characters long, dictating a rectangle with Our normalized text is 54 characters long, dictating a rectangle with `c = 8` and `r = 7`:
`c = 8` and `r = 7`:
```text ```text
"ifmanwas" "ifmanwas"
@@ -45,8 +42,7 @@ Our normalized text is 54 characters long, dictating a rectangle with
"sroots " "sroots "
``` ```
The coded message is obtained by reading down the columns going left to The coded message is obtained by reading down the columns going left to right.
right.
The message above is coded as: The message above is coded as:
@@ -54,17 +50,14 @@ The message above is coded as:
"imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau" "imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau"
``` ```
Output the encoded text in chunks that fill perfect rectangles `(r X c)`, Output the encoded text in chunks that fill perfect rectangles `(r X c)`, with `c` chunks of `r` length, separated by spaces.
with `c` chunks of `r` length, separated by spaces. For phrases that are For phrases that are `n` characters short of the perfect rectangle, pad each of the last `n` chunks with a single trailing space.
`n` characters short of the perfect rectangle, pad each of the last `n`
chunks with a single trailing space.
```text ```text
"imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau " "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau "
``` ```
Notice that were we to stack these, we could visually decode the Notice that were we to stack these, we could visually decode the ciphertext back in to the original message:
ciphertext back in to the original message:
```text ```text
"imtgdvs" "imtgdvs"
@@ -75,4 +68,4 @@ ciphertext back in to the original message:
"wttddes" "wttddes"
"aohghn " "aohghn "
"sseoau " "sseoau "
``` ```

View File

@@ -15,5 +15,5 @@
}, },
"blurb": "Implement the classic method for composing secret messages called a square code.", "blurb": "Implement the classic method for composing secret messages called a square code.",
"source": "J Dalbey's Programming Practice problems", "source": "J Dalbey's Programming Practice problems",
"source_url": "http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html" "source_url": "https://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html"
} }

View File

@@ -1,17 +1,31 @@
# Description # Instructions
Write a function that returns the earned points in a single toss of a Darts game. Write a function that returns the earned points in a single toss of a Darts game.
[Darts](https://en.wikipedia.org/wiki/Darts) is a game where players [Darts][darts] is a game where players throw darts at a [target][darts-target].
throw darts to a [target](https://en.wikipedia.org/wiki/Darts#/media/File:Darts_in_a_dartboard.jpg).
In our particular instance of the game, the target rewards with 4 different amounts of points, depending on where the dart lands: In our particular instance of the game, the target rewards 4 different amounts of points, depending on where the dart lands:
* If the dart lands outside the target, player earns no points (0 points). ![Our dart scoreboard with values from a complete miss to a bullseye](https://assets.exercism.org/images/exercises/darts/darts-scoreboard.svg)
* If the dart lands in the outer circle of the target, player earns 1 point.
* If the dart lands in the middle circle of the target, player earns 5 points.
* If the dart lands in the inner circle of the target, player earns 10 points.
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. Of course, they are all centered to the same point (That is, the circles are [concentric](http://mathworld.wolfram.com/ConcentricCircles.html)) defined by the coordinates (0, 0). - If the dart lands outside the target, player earns no points (0 points).
- If the dart lands in the outer circle of the target, player earns 1 point.
- If the dart lands in the middle circle of the target, player earns 5 points.
- If the dart lands in the inner circle of the target, player earns 10 points.
Write a function that given a point in the target (defined by its `real` cartesian coordinates `x` and `y`), returns the correct amount earned by a dart landing in that point. 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.
Of course, they are all centered at the same point — that is, the circles are [concentric][] defined by the coordinates (0, 0).
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.
## Credit
The scoreboard image was created by [habere-et-dispertire][habere-et-dispertire] using [Inkscape][inkscape].
[darts]: https://en.wikipedia.org/wiki/Darts
[darts-target]: https://en.wikipedia.org/wiki/Darts#/media/File:Darts_in_a_dartboard.jpg
[concentric]: https://mathworld.wolfram.com/ConcentricCircles.html
[cartesian-coordinates]: https://www.mathsisfun.com/data/cartesian-coordinates.html
[real-numbers]: https://www.mathsisfun.com/numbers/real-numbers.html
[habere-et-dispertire]: https://exercism.org/profiles/habere-et-dispertire
[inkscape]: https://en.wikipedia.org/wiki/Inkscape

View File

@@ -14,5 +14,5 @@
] ]
}, },
"blurb": "Write a function that returns the earned points in a single toss of a Darts game.", "blurb": "Write a function that returns the earned points in a single toss of a Darts game.",
"source": "Inspired by an exercise created by a professor Della Paolera in Argentina." "source": "Inspired by an exercise created by a professor Della Paolera in Argentina"
} }

View File

@@ -1,4 +1,4 @@
# Description # Instructions
Find the difference between the square of the sum and the sum of the squares of the first N natural numbers. Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.

View File

@@ -1,13 +1,20 @@
{ {
"blurb": "Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.", "blurb": "Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.",
"authors": ["dwivedirahul44"], "authors": [
"contributors": [ "dwivedirahul44"
],
"contributors": [],
"files": {
"solution": [
"zcl_difference_of_squares.clas.abap"
], ],
"files": { "test": [
"solution": ["zcl_difference_of_squares.clas.abap"], "zcl_difference_of_squares.clas.testclasses.abap"
"test": ["zcl_difference_of_squares.clas.testclasses.abap"], ],
"example": [".meta/zcl_difference_of_squares.clas.abap"] "example": [
}, ".meta/zcl_difference_of_squares.clas.abap"
"source": "Problem 6 at Project Euler", ]
"source_url": "http://projecteuler.net/problem=6" },
} "source": "Problem 6 at Project Euler",
"source_url": "https://projecteuler.net/problem=6"
}

View File

@@ -13,7 +13,7 @@
".meta/zcl_etl.clas.abap" ".meta/zcl_etl.clas.abap"
] ]
}, },
"blurb": "We are going to do the `Transform` step of an Extract-Transform-Load.", "blurb": "Change the data format for scoring a game to more easily add other languages.",
"source": "The Jumpstart Lab team", "source": "Based on an exercise by the JumpstartLab team for students at The Turing School of Software and Design.",
"source_url": "http://jumpstartlab.com" "source_url": "https://turing.edu"
} }

View File

@@ -1,13 +1,11 @@
# Description # Instructions
Calculate the number of grains of wheat on a chessboard given that the number Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.
on each square doubles.
There once was a wise servant who saved the life of a prince. The king There once was a wise servant who saved the life of a prince.
promised to pay whatever the servant could dream up. Knowing that the The king promised to pay whatever the servant could dream up.
king loved chess, the servant told the king he would like to have grains Knowing that the king loved chess, the servant told the king he would like to have grains of wheat.
of wheat. One grain on the first square of a chess board, with the number One grain on the first square of a chess board, with the number of grains doubling on each successive square.
of grains doubling on each successive square.
There are 64 squares on a chessboard (where square 1 has one grain, square 2 has two grains, and so on). There are 64 squares on a chessboard (where square 1 has one grain, square 2 has two grains, and so on).
@@ -15,14 +13,3 @@ Write code that shows:
- how many grains were on a given square, and - how many grains were on a given square, and
- the total number of grains on the chessboard - the total number of grains on the chessboard
## For bonus points
Did you get the tests passing and the code clean? If you want to, these
are some additional things you could try:
- Optimize for speed.
- Optimize for readability.
Then please share your thoughts in a comment on the submission. Did this
experiment make the code better? Worse? Did you learn anything from it?

View File

@@ -14,6 +14,6 @@
] ]
}, },
"blurb": "Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.", "blurb": "Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.",
"source": "JavaRanch Cattle Drive, exercise 6", "source": "The CodeRanch Cattle Drive, Assignment 6",
"source_url": "http://www.javaranch.com/grains.jsp" "source_url": "https://coderanch.com/wiki/718824/Grains"
} }

View File

@@ -1,12 +1,18 @@
# Description # Instructions
Calculate the Hamming Distance between two DNA strands. Calculate the Hamming Distance between two DNA strands.
Your body is made up of cells that contain DNA. Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells. In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime! Your body is made up of cells that contain DNA.
Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells.
In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime!
When cells divide, their DNA replicates too. Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information. If we compare two strands of DNA and count the differences between them we can see how many mistakes occurred. This is known as the "Hamming Distance". When cells divide, their DNA replicates too.
Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information.
If we compare two strands of DNA and count the differences between them we can see how many mistakes occurred.
This is known as the "Hamming Distance".
We read DNA using the letters C,A,G and T. Two strands might look like this: We read DNA using the letters C,A,G and T.
Two strands might look like this:
GAGCCTACTAACGGGAT GAGCCTACTAACGGGAT
CATCGTAATGACGGCCT CATCGTAATGACGGCCT
@@ -18,6 +24,4 @@ The Hamming Distance is useful for lots of things in science, not just biology,
## Implementation notes ## Implementation notes
The Hamming distance is only defined for sequences of equal length, so The Hamming distance is only defined for sequences of equal length, so an attempt to calculate it between sequences of different lengths should not work.
an attempt to calculate it between sequences of different lengths should
not work.

View File

@@ -15,5 +15,5 @@
}, },
"blurb": "Calculate the Hamming difference between two DNA strands.", "blurb": "Calculate the Hamming difference between two DNA strands.",
"source": "The Calculating Point Mutations problem at Rosalind", "source": "The Calculating Point Mutations problem at Rosalind",
"source_url": "http://rosalind.info/problems/hamm/" "source_url": "https://rosalind.info/problems/hamm/"
} }

View File

@@ -1,15 +1,16 @@
# Instructions # Instructions
The classical introductory exercise. Just say "Hello, World!". The classical introductory exercise.
Just say "Hello, World!".
["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is ["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment.
the traditional first program for beginning programming in a new language
or environment.
The objectives are simple: The objectives are simple:
- Write a class that returns the string "Hello, World!". - Modify the provided code so that it produces the string "Hello, World!".
- Run the test suite and make sure that it succeeds. - Run the test suite and make sure that it succeeds.
- Submit your solution and check it at the website. - Submit your solution and check it at the website.
If everything goes well, you will be ready to fetch your first real exercise. If everything goes well, you will be ready to fetch your first real exercise.
[hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program

View File

@@ -13,7 +13,7 @@
".meta/zcl_hello_world.clas.abap" ".meta/zcl_hello_world.clas.abap"
] ]
}, },
"blurb": "The classical introductory exercise. Just say \"Hello, World!\"", "blurb": "Exercism's classic introductory exercise. Just say \"Hello, World!\".",
"source": "This is an exercise to introduce users to using Exercism", "source": "This is an exercise to introduce users to using Exercism",
"source_url": "http://en.wikipedia.org/wiki/%22Hello,_world!%22_program" "source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program"
} }

View File

@@ -1,5 +1,6 @@
# Description # Instructions
Manage a game player's High Score list. Manage a game player's High Score list.
Your task is to build a high-score component of the classic Frogger game, one of the highest selling and addictive games of all time, and a classic of the arcade era. Your task is to write methods that return the highest score from the list, the last added score and the three highest scores. Your task is to build a high-score component of the classic Frogger game, one of the highest selling and most addictive games of all time, and a classic of the arcade era.
Your task is to write methods that return the highest score from the list, the last added score and the three highest scores.

View File

@@ -1,4 +1,4 @@
# Description # Instructions
Determine if a word or phrase is an isogram. Determine if a word or phrase is an isogram.
@@ -11,4 +11,4 @@ Examples of isograms:
- downstream - downstream
- six-year-old - six-year-old
The word *isograms*, however, is not an isogram, because the s repeats. The word _isograms_, however, is not an isogram, because the s repeats.

View File

@@ -13,7 +13,7 @@
".meta/zcl_isogram.clas.abap" ".meta/zcl_isogram.clas.abap"
] ]
}, },
"blurb": "Determine if a word or phrase is an isogram", "blurb": "Determine if a word or phrase is an isogram.",
"source": "Wikipedia", "source": "Wikipedia",
"source_url": "https://en.wikipedia.org/wiki/Isogram" "source_url": "https://en.wikipedia.org/wiki/Isogram"
} }

View File

@@ -1,11 +1,10 @@
# Description # Instructions
Given a diagram, determine which plants each child in the kindergarten class is Given a diagram, determine which plants each child in the kindergarten class is
responsible for. responsible for.
The kindergarten class is learning about growing plants. The teacher The kindergarten class is learning about growing plants.
thought it would be a good idea to give them actual seeds, plant them in The teacher thought it would be a good idea to give them actual seeds, plant them in actual dirt, and grow actual plants.
actual dirt, and grow actual plants.
They've chosen to grow grass, clover, radishes, and violets. They've chosen to grow grass, clover, radishes, and violets.
@@ -25,8 +24,8 @@ There are 12 children in the class:
- Eve, Fred, Ginny, Harriet, - Eve, Fred, Ginny, Harriet,
- Ileana, Joseph, Kincaid, and Larry. - Ileana, Joseph, Kincaid, and Larry.
Each child gets 4 cups, two on each row. Their teacher assigns cups to Each child gets 4 cups, two on each row.
the children alphabetically by their names. Their teacher assigns cups to the children alphabetically by their names.
The following diagram represents Alice's plants: The following diagram represents Alice's plants:
@@ -36,12 +35,11 @@ VR......................
RG...................... RG......................
``` ```
In the first row, nearest the windows, she has a violet and a radish. In the In the first row, nearest the windows, she has a violet and a radish.
second row she has a radish and some grass. In the second row she has a radish and some grass.
Your program will be given the plants from left-to-right starting with Your program will be given the plants from left-to-right starting with the row nearest the windows.
the row nearest the windows. From this, it should be able to determine From this, it should be able to determine which plants belong to each student.
which plants belong to each student.
For example, if it's told that the garden looks like so: For example, if it's told that the garden looks like so:
@@ -57,4 +55,4 @@ Then if asked for Alice's plants, it should provide:
While asking for Bob's plants would yield: While asking for Bob's plants would yield:
- Clover, grass, clover, clover - Clover, grass, clover, clover

View File

@@ -14,6 +14,6 @@
] ]
}, },
"blurb": "Given a diagram, determine which plants each child in the kindergarten class is responsible for.", "blurb": "Given a diagram, determine which plants each child in the kindergarten class is responsible for.",
"source": "Random musings during airplane trip.", "source": "Exercise by the JumpstartLab team for students at The Turing School of Software and Design.",
"source_url": "http://jumpstartlab.com" "source_url": "https://turing.edu"
} }

View File

@@ -1,4 +1,4 @@
# Description # Instructions
Given a year, report if it is a leap year. Given a year, report if it is a leap year.
@@ -10,15 +10,13 @@ on every year that is evenly divisible by 4
unless the year is also evenly divisible by 400 unless the year is also evenly divisible by 400
``` ```
For example, 1997 is not a leap year, but 1996 is. 1900 is not a leap For example, 1997 is not a leap year, but 1996 is.
year, but 2000 is. 1900 is not a leap year, but 2000 is.
## Notes ## Notes
Though our exercise adopts some very simple rules, there is more to Though our exercise adopts some very simple rules, there is more to learn!
learn!
For a delightful, four minute explanation of the whole leap year For a delightful, four minute explanation of the whole leap year phenomenon, go watch [this youtube video][video].
phenomenon, go watch [this youtube video][video].
[video]: http://www.youtube.com/watch?v=xX96xng7sAE [video]: https://www.youtube.com/watch?v=xX96xng7sAE

View File

@@ -14,6 +14,6 @@
] ]
}, },
"blurb": "Given a year, report if it is a leap year.", "blurb": "Given a year, report if it is a leap year.",
"source": "JavaRanch Cattle Drive, exercise 3", "source": "CodeRanch Cattle Drive, Assignment 3",
"source_url": "http://www.javaranch.com/leap.jsp" "source_url": "https://coderanch.com/t/718816/Leap"
} }

View File

@@ -1,7 +1,6 @@
# Description # Instructions
Given a string representing a matrix of numbers, return the rows and columns of Given a string representing a matrix of numbers, return the rows and columns of that matrix.
that matrix.
So given a string with embedded newlines like: So given a string with embedded newlines like:
@@ -23,10 +22,8 @@ representing this matrix:
your code should be able to spit out: your code should be able to spit out:
- A list of the rows, reading each row left-to-right while moving - A list of the rows, reading each row left-to-right while moving top-to-bottom across the rows,
top-to-bottom across the rows, - A list of the columns, reading each column top-to-bottom while moving from left-to-right.
- A list of the columns, reading each column top-to-bottom while moving
from left-to-right.
The rows for our example matrix: The rows for our example matrix:
@@ -38,4 +35,4 @@ And its columns:
- 9, 5, 6 - 9, 5, 6
- 8, 3, 6 - 8, 3, 6
- 7, 2, 7 - 7, 2, 7

View File

@@ -14,5 +14,6 @@
] ]
}, },
"blurb": "Given a string representing a matrix of numbers, return the rows and columns of that matrix.", "blurb": "Given a string representing a matrix of numbers, return the rows and columns of that matrix.",
"source_url": "http://jumpstartlab.com" "source_url": "https://turing.edu",
"source": "Exercise by the JumpstartLab team for students at The Turing School of Software and Design."
} }

View File

@@ -1,24 +1,19 @@
# Description # Instructions
Add the mine counts to a completed Minesweeper board. Add the mine counts to a completed Minesweeper board.
Minesweeper is a popular game where the user has to find the mines using Minesweeper is a popular game where the user has to find the mines using numeric hints that indicate how many mines are directly adjacent (horizontally, vertically, diagonally) to a square.
numeric hints that indicate how many mines are directly adjacent
(horizontally, vertically, diagonally) to a square.
In this exercise you have to create some code that counts the number of In this exercise you have to create some code that counts the number of mines adjacent to a given empty square and replaces that square with the count.
mines adjacent to a given empty square and replaces that square with the
count.
The board is a rectangle composed of blank space (' ') characters. A mine The board is a rectangle composed of blank space (' ') characters.
is represented by an asterisk ('\*') character. A mine is represented by an asterisk (`*`) character.
If a given space has no adjacent mines at all, leave that square blank. If a given space has no adjacent mines at all, leave that square blank.
## Examples ## Examples
For example you may receive a 5 x 4 board like this (empty spaces are For example you may receive a 5 x 4 board like this (empty spaces are represented here with the '·' character for display on screen):
represented here with the '·' character for display on screen):
```text ```text
·*·*· ·*·*·

View File

@@ -13,5 +13,5 @@
".meta/zcl_minesweeper.clas.abap" ".meta/zcl_minesweeper.clas.abap"
] ]
}, },
"blurb": "Add the numbers to a minesweeper board" "blurb": "Add the numbers to a minesweeper board."
} }

View File

@@ -1,9 +1,7 @@
# Description # Instructions
Given a number n, determine what the nth prime is. Given a number n, determine what the nth prime is.
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
the 6th prime is 13.
If your language provides methods in the standard library to deal with prime If your language provides methods in the standard library to deal with prime numbers, pretend they don't exist and implement them yourself.
numbers, pretend they don't exist and implement them yourself.

View File

@@ -15,5 +15,5 @@
}, },
"blurb": "Given a number n, determine what the nth prime is.", "blurb": "Given a number n, determine what the nth prime is.",
"source": "A variation on Problem 7 at Project Euler", "source": "A variation on Problem 7 at Project Euler",
"source_url": "http://projecteuler.net/problem=7" "source_url": "https://projecteuler.net/problem=7"
} }

View File

@@ -2,19 +2,23 @@
Clean up user-entered phone numbers so that they can be sent SMS messages. Clean up user-entered phone numbers so that they can be sent SMS messages.
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. All NANP-countries share the same international country code: `1`. 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.
All NANP-countries share the same international country code: `1`.
NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as _area code_, followed by a seven-digit local number. The first three digits of the local number represent the _exchange code_, followed by the unique four-digit number which is the _subscriber number_. NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as _area code_, followed by a seven-digit local number.
The first three digits of the local number represent the _exchange code_, followed by the unique four-digit number which is the _subscriber number_.
The format is usually represented as The format is usually represented as
```text ```text
(NXX)-NXX-XXXX NXX NXX-XXXX
``` ```
where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9. where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9.
Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present. Sometimes they also have the country code (represented as `1` or `+1`) prefixed.
Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code if present.
For example, the inputs For example, the inputs
@@ -27,4 +31,4 @@ should all produce the output
`6139950253` `6139950253`
**Note:** As this exercise only deals with telephone numbers used in NANP-countries, only 1 is considered a valid country code. **Note:** As this exercise only deals with telephone numbers used in NANP-countries, only 1 is considered a valid country code.

View File

@@ -14,6 +14,6 @@
] ]
}, },
"blurb": "Clean up user-entered phone numbers so that they can be sent SMS messages.", "blurb": "Clean up user-entered phone numbers so that they can be sent SMS messages.",
"source": "Event Manager by JumpstartLab", "source": "Exercise by the JumpstartLab team for students at The Turing School of Software and Design.",
"source_url": "http://tutorials.jumpstartlab.com/projects/eventmanager.html" "source_url": "https://turing.edu"
} }

View File

@@ -1,4 +1,4 @@
# Description # Instructions
Compute the prime factors of a given natural number. Compute the prime factors of a given natural number.
@@ -10,21 +10,27 @@ Note that 1 is not a prime number.
What are the prime factors of 60? What are the prime factors of 60?
- Our first divisor is 2. 2 goes into 60, leaving 30. - Our first divisor is 2.
2 goes into 60, leaving 30.
- 2 goes into 30, leaving 15. - 2 goes into 30, leaving 15.
- 2 doesn't go cleanly into 15. So let's move on to our next divisor, 3. - 2 doesn't go cleanly into 15.
So let's move on to our next divisor, 3.
- 3 goes cleanly into 15, leaving 5. - 3 goes cleanly into 15, leaving 5.
- 3 does not go cleanly into 5. The next possible factor is 4. - 3 does not go cleanly into 5.
- 4 does not go cleanly into 5. The next possible factor is 5. The next possible factor is 4.
- 4 does not go cleanly into 5.
The next possible factor is 5.
- 5 does go cleanly into 5. - 5 does go cleanly into 5.
- We're left only with 1, so now, we're done. - We're left only with 1, so now, we're done.
Our successful divisors in that computation represent the list of prime Our successful divisors in that computation represent the list of prime factors of 60: 2, 2, 3, and 5.
factors of 60: 2, 2, 3, and 5.
You can check this yourself: You can check this yourself:
- 2 \* 2 \* 3 * 5 ```text
- = 4 * 15 2 * 2 * 3 * 5
- = 60 = 4 * 15
- Success! = 60
```
Success!

View File

@@ -15,5 +15,5 @@
}, },
"blurb": "Compute the prime factors of a given natural number.", "blurb": "Compute the prime factors of a given natural number.",
"source": "The Prime Factors Kata by Uncle Bob", "source": "The Prime Factors Kata by Uncle Bob",
"source_url": "http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata" "source_url": "https://web.archive.org/web/20221026171801/http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata"
} }

View File

@@ -1,6 +1,8 @@
# Description # Instructions
Your task is to convert a number into a string that contains raindrop sounds corresponding to certain potential factors. A factor is a number that evenly divides into another number, leaving no remainder. The simplest way to test if one number is a factor of another is to use the [modulo operation](https://en.wikipedia.org/wiki/Modulo_operation). Your task is to convert a number into a string that contains raindrop sounds corresponding to certain potential factors.
A factor is a number that evenly divides into another number, leaving no remainder.
The simplest way to test if one number is a factor of another is to use the [modulo operation][modulo].
The rules of `raindrops` are that if a given number: The rules of `raindrops` are that if a given number:
@@ -13,4 +15,6 @@ The rules of `raindrops` are that if a given number:
- 28 has 7 as a factor, but not 3 or 5, so the result would be "Plong". - 28 has 7 as a factor, but not 3 or 5, so the result would be "Plong".
- 30 has both 3 and 5 as factors, but not 7, so the result would be "PlingPlang". - 30 has both 3 and 5 as factors, but not 7, so the result would be "PlingPlang".
- 34 is not factored by 3, 5, or 7, so the result would be "34". - 34 is not factored by 3, 5, or 7, so the result would be "34".
[modulo]: https://en.wikipedia.org/wiki/Modulo_operation

View File

@@ -13,6 +13,7 @@
".meta/zcl_raindrops.clas.abap" ".meta/zcl_raindrops.clas.abap"
] ]
}, },
"blurb": "Your task is to convert a number into a string that contains raindrop sounds corresponding to certain potential factors.", "blurb": "Convert a number to a string, the content of which depends on the number's factors.",
"source_url": "https://github.com/exercism/problem-specifications/blob/main/exercises/raindrops/description.md" "source_url": "https://en.wikipedia.org/wiki/Fizz_buzz",
"source": "A variation on FizzBuzz, a famous technical interview question that is intended to weed out potential candidates. That question is itself derived from Fizz Buzz, a popular children's game for teaching division."
} }

View File

@@ -1,4 +1,4 @@
# Description # Instructions
If you want to build something using a Raspberry Pi, you'll probably use _resistors_. If you want to build something using a Raspberry Pi, you'll probably use _resistors_.
For this exercise, you need to know two things about them: For this exercise, you need to know two things about them:
@@ -31,6 +31,9 @@ The goal of this exercise is to create a way:
- to look up the numerical value associated with a particular color band - to look up the numerical value associated with a particular color band
- to list the different band colors - to list the different band colors
Mnemonics map the colors to the numbers, that, when stored as an array, happen to map to their index in the array: Better Be Right Or Your Great Big Values Go Wrong. Mnemonics map the colors to the numbers, that, when stored as an array, happen to map to their index in the array:
Better Be Right Or Your Great Big Values Go Wrong.
More information on the color encoding of resistors can be found in the [Electronic color code Wikipedia article](https://en.wikipedia.org/wiki/Electronic_color_code) More information on the color encoding of resistors can be found in the [Electronic color code Wikipedia article][e-color-code].
[e-color-code]: https://en.wikipedia.org/wiki/Electronic_color_code

View File

@@ -13,7 +13,7 @@
".meta/zcl_resistor_color.clas.abap" ".meta/zcl_resistor_color.clas.abap"
] ]
}, },
"blurb": "Convert a resistor band's color to its numeric representation", "blurb": "Convert a resistor band's color to its numeric representation.",
"source": "Maud de Vries, Erik Schierboom", "source": "Maud de Vries, Erik Schierboom",
"source_url": "https://github.com/exercism/problem-specifications/issues/1458" "source_url": "https://github.com/exercism/problem-specifications/issues/1458"
} }

View File

@@ -1,7 +1,7 @@
# Instructions # Instructions
Reverse a string. Reverse a string
For example: For example:
* input: `cool` input: "cool"
* output: `looc` output: "looc"

View File

@@ -13,5 +13,7 @@
".meta/zcl_reverse_string.clas.abap" ".meta/zcl_reverse_string.clas.abap"
] ]
}, },
"blurb": "Reverse a string" "blurb": "Reverse a string.",
"source": "Introductory challenge to reverse an input string",
"source_url": "https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb"
} }

View File

@@ -1,9 +1,8 @@
# Description # Instructions
Implement run-length encoding and decoding. Implement run-length encoding and decoding.
Run-length encoding (RLE) is a simple form of data compression, where runs Run-length encoding (RLE) is a simple form of data compression, where runs (consecutive data elements) are replaced by just one data value and count.
(consecutive data elements) are replaced by just one data value and count.
For example we can represent the original 53 characters with only 13. For example we can represent the original 53 characters with only 13.
@@ -11,14 +10,11 @@ For example we can represent the original 53 characters with only 13.
"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB" -> "12WB12W3B24WB" "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB" -> "12WB12W3B24WB"
``` ```
RLE allows the original data to be perfectly reconstructed from RLE allows the original data to be perfectly reconstructed from the compressed data, which makes it a lossless data compression.
the compressed data, which makes it a lossless data compression.
```text ```text
"AABCCCDEEEE" -> "2AB3CD4E" -> "AABCCCDEEEE" "AABCCCDEEEE" -> "2AB3CD4E" -> "AABCCCDEEEE"
``` ```
For simplicity, you can assume that the unencoded string will only contain For simplicity, you can assume that the unencoded string will only contain the letters A through Z (either lower or upper case) and whitespace.
the letters A through Z (either lower or upper case) and whitespace. This way This way data to be encoded will never contain any numbers and numbers inside data to be decoded always represent the count for the following character.
data to be encoded will never contain any numbers and numbers inside data to
be decoded always represent the count for the following character.

View File

@@ -1,4 +1,4 @@
# Description # Instructions
Given a word, compute the Scrabble score for that word. Given a word, compute the Scrabble score for that word.
@@ -37,4 +37,4 @@ And to total:
## Extensions ## Extensions
- You can play a double or a triple letter. - You can play a double or a triple letter.
- You can play a double or a triple word. - You can play a double or a triple word.

View File

@@ -14,5 +14,6 @@
] ]
}, },
"blurb": "Given a word, compute the Scrabble score for that word.", "blurb": "Given a word, compute the Scrabble score for that word.",
"source_url": "https://github.com/rchatley/extreme_startup" "source_url": "https://github.com/rchatley/extreme_startup",
"source": "Inspired by the Extreme Startup game"
} }

View File

@@ -43,5 +43,6 @@ jump, double blink
~~~~exercism/note ~~~~exercism/note
If you aren't sure what binary is or how it works, check out [this binary tutorial][intro-to-binary]. If you aren't sure what binary is or how it works, check out [this binary tutorial][intro-to-binary].
[intro-to-binary]: https://medium.com/basecs/bits-bytes-building-with-binary-13cb4289aafa [intro-to-binary]: https://medium.com/basecs/bits-bytes-building-with-binary-13cb4289aafa
~~~~ ~~~~

View File

@@ -15,5 +15,5 @@
}, },
"blurb": "Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.", "blurb": "Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.",
"source": "Bert, in Mary Poppins", "source": "Bert, in Mary Poppins",
"source_url": "http://www.imdb.com/title/tt0058331/quotes/qt0437047" "source_url": "https://www.imdb.com/title/tt0058331/quotes/?item=qt0437047"
} }

View File

@@ -17,9 +17,9 @@ One for you, one for me.
Here are some examples: Here are some examples:
|Name |Dialogue | Name | Dialogue |
|:-------|:------------------ | :----- | :-------------------------- |
|Alice |One for Alice, one for me. | Alice | One for Alice, one for me. |
|Bohdan |One for Bohdan, one for me. | Bohdan | One for Bohdan, one for me. |
| |One for you, one for me. | | One for you, one for me. |
|Zaphod |One for Zaphod, one for me. | Zaphod | One for Zaphod, one for me. |

View File

@@ -14,6 +14,5 @@
] ]
}, },
"blurb": "Given a phrase, count the occurrences of each word in that phrase.", "blurb": "Given a phrase, count the occurrences of each word in that phrase.",
"source": "This is a classic toy problem, but we were reminded of it by seeing it in the Go Tour.", "source": "This is a classic toy problem, but we were reminded of it by seeing it in the Go Tour."
"source_url": "https://github.com/exercism/javascript/tree/main/exercises/practice/word-count"
} }