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:
@@ -1,4 +1,4 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
Convert a phrase to its acronym.
|
||||
|
||||
@@ -10,8 +10,8 @@ Punctuation is handled as follows: hyphens are word separators (like whitespace)
|
||||
|
||||
For example:
|
||||
|
||||
|Input|Output|
|
||||
|-|-|
|
||||
|As Soon As Possible|ASAP|
|
||||
|Liquid-crystal display|LCD|
|
||||
|Thank George It's Friday!|TGIF|
|
||||
| Input | Output |
|
||||
| ------------------------- | ------ |
|
||||
| As Soon As Possible | ASAP |
|
||||
| Liquid-crystal display | LCD |
|
||||
| Thank George It's Friday! | TGIF |
|
||||
|
||||
@@ -14,5 +14,6 @@
|
||||
]
|
||||
},
|
||||
"blurb": "Convert a long phrase to its acronym.",
|
||||
"source_url": "https://github.com/monkbroc"
|
||||
"source_url": "https://github.com/monkbroc",
|
||||
"source": "Julien Vanier"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
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.
|
||||
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
|
||||
|
||||
@@ -23,7 +23,7 @@ Where:
|
||||
For the Roman alphabet `m` is `26`.
|
||||
- `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.
|
||||
Otherwise it should encrypt or decrypt with the provided key.
|
||||
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
},
|
||||
"blurb": "Create an implementation of the Affine cipher, an ancient encryption algorithm from the Middle East.",
|
||||
"source": "Wikipedia",
|
||||
"source_url": "http://en.wikipedia.org/wiki/Affine_cipher"
|
||||
"source_url": "https://en.wikipedia.org/wiki/Affine_cipher"
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
An anagram is a rearrangement of letters to form a new word.
|
||||
Given a word and a list of candidates, select the sublist of anagrams of the given word.
|
||||
An anagram is a rearrangement of letters to form a new word: for example `"owns"` is an anagram of `"snow"`.
|
||||
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"
|
||||
"inlets" "banana"` the program should return a list containing
|
||||
`"inlets"`.
|
||||
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.
|
||||
|
||||
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"`.
|
||||
|
||||
@@ -14,5 +14,6 @@
|
||||
]
|
||||
},
|
||||
"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"
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
For example:
|
||||
|
||||
- 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`
|
||||
- 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.
|
||||
|
||||
|
||||
@@ -14,5 +14,6 @@
|
||||
]
|
||||
},
|
||||
"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"
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
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
|
||||
transposing all the letters in the alphabet such that the resulting
|
||||
alphabet is backwards. The first letter is replaced with the last
|
||||
letter, the second with the second-last, and so 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.
|
||||
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:
|
||||
|
||||
@@ -14,16 +12,16 @@ Plain: abcdefghijklmnopqrstuvwxyz
|
||||
Cipher: zyxwvutsrqponmlkjihgfedcba
|
||||
```
|
||||
|
||||
It is a very weak cipher because it only has one possible key, and it is
|
||||
a simple mono-alphabetic substitution cipher. However, this may not have
|
||||
been an issue in the cipher's time.
|
||||
It is a very weak cipher because it only has one possible key, and it is a simple mono-alphabetic substitution cipher.
|
||||
However, this may not have been an issue in the cipher's time.
|
||||
|
||||
Ciphertext is written out in groups of fixed length, the traditional group size
|
||||
being 5 letters, and punctuation is excluded. This is to make it harder to guess
|
||||
things based on word boundaries.
|
||||
Ciphertext is written out in groups of fixed length, the traditional group size being 5 letters, leaving numbers unchanged, and punctuation is excluded.
|
||||
This is to make it harder to guess things based on word boundaries.
|
||||
All text will be encoded as lowercase letters.
|
||||
|
||||
## Examples
|
||||
|
||||
- Encoding `test` gives `gvhg`
|
||||
- Encoding `x123 yes` gives `c123b vh`
|
||||
- Decoding `gvhg` gives `test`
|
||||
- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog`
|
||||
- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog`
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
},
|
||||
"blurb": "Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.",
|
||||
"source": "Wikipedia",
|
||||
"source_url": "http://en.wikipedia.org/wiki/Atbash"
|
||||
"source_url": "https://en.wikipedia.org/wiki/Atbash"
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
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.
|
||||
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.
|
||||
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?
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
},
|
||||
"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_url": "http://pine.fm/LearnToProgram/?Chapter=06"
|
||||
"source_url": "https://pine.fm/LearnToProgram/?Chapter=06"
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
# Instructions
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
One copy of any of the five books costs $8.
|
||||
|
||||
If, however, you buy two different books, you get a 5%
|
||||
discount on those two books.
|
||||
If, however, you buy two different books, you get a 5% discount on those two books.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
Your mission is to write a piece of code to calculate the
|
||||
price of any conceivable shopping basket (containing only
|
||||
books of the same series), giving as big a discount as
|
||||
possible.
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
- 1 group of 5 --> 25% discount (1st,2nd,3rd,4th,5th)
|
||||
- +1 group of 3 --> 10% discount (1st,2nd,3rd)
|
||||
- 1 group of 5 (1st, 2nd,3rd, 4th, 5th)
|
||||
- 1 group of 3 (1st, 2nd, 3rd)
|
||||
|
||||
This would give a total of:
|
||||
|
||||
- 5 books at a 25% discount
|
||||
- +3 books at a 10% discount
|
||||
- 3 books at a 10% discount
|
||||
|
||||
Resulting in:
|
||||
|
||||
- 5 × (8 - 2.00) = 5 × 6.00 = $30.00
|
||||
- +3 × (8 - 0.80) = 3 × 7.20 = $21.60
|
||||
- 5 × (100% - 25%) × $8 = 5 × $6.00 = $30.00, plus
|
||||
- 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:
|
||||
|
||||
- 1 group of 4 books --> 20% discount (1st,2nd,3rd,4th)
|
||||
- +1 group of 4 books --> 20% discount (1st,2nd,3rd,5th)
|
||||
- 1 group of 4 books (1st, 2nd, 3rd, 4th)
|
||||
- 1 group of 4 books (1st, 2nd, 3rd, 5th)
|
||||
|
||||
This would give a total of:
|
||||
|
||||
- 4 books at a 20% discount
|
||||
- +4 books at a 20% discount
|
||||
- 4 books at a 20% discount
|
||||
|
||||
Resulting in:
|
||||
|
||||
- 4 × (8 - 1.60) = 4 × 6.40 = $25.60
|
||||
- +4 × (8 - 1.60) = 4 × 6.40 = $25.60
|
||||
- 4 × (100% - 20%) × $8 = 4 × $6.40 = $25.60, plus
|
||||
- 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.
|
||||
|
||||
@@ -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.",
|
||||
"source": "Inspired by the harry potter kata from Cyber-Dojo.",
|
||||
"source_url": "http://cyber-dojo.org"
|
||||
"source_url": "https://cyber-dojo.org"
|
||||
}
|
||||
|
||||
@@ -14,6 +14,5 @@
|
||||
]
|
||||
},
|
||||
"blurb": "Implement a clock that handles times without dates.",
|
||||
"source": "Pairing session with Erin Drummond",
|
||||
"source_url": "https://twitter.com/ebdrummond"
|
||||
"source": "Pairing session with Erin Drummond"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
The Collatz Conjecture or 3x+1 problem can be summarized as follows:
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
Implement the classic method for composing secret messages called a square code.
|
||||
|
||||
Given an English text, output the encoded version of that text.
|
||||
|
||||
First, the input is normalized: the spaces and punctuation are removed
|
||||
from the English text and the message is down-cased.
|
||||
First, the input is normalized: the spaces and punctuation are removed from the English text and the message is down-cased.
|
||||
|
||||
Then, the normalized characters are broken into rows. These rows can be
|
||||
regarded as forming a rectangle when printed with intervening newlines.
|
||||
Then, the normalized characters are broken into rows.
|
||||
These rows can be regarded as forming a rectangle when printed with intervening newlines.
|
||||
|
||||
For example, the sentence
|
||||
|
||||
@@ -22,18 +21,16 @@ is normalized to:
|
||||
"ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots"
|
||||
```
|
||||
|
||||
The plaintext should be organized in to a rectangle. The size of the
|
||||
rectangle should be decided by the length of the message.
|
||||
The plaintext should be organized into a rectangle as square as possible.
|
||||
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
|
||||
the rectangle `r` x `c` find the smallest possible integer `c` such that:
|
||||
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:
|
||||
|
||||
- `r * c >= length(message)`,
|
||||
- `r * c >= length of message`,
|
||||
- and `c >= r`,
|
||||
- and `c - r <= 1`.
|
||||
|
||||
Our normalized text is 54 characters long, dictating a rectangle with
|
||||
`c = 8` and `r = 7`:
|
||||
Our normalized text is 54 characters long, dictating a rectangle with `c = 8` and `r = 7`:
|
||||
|
||||
```text
|
||||
"ifmanwas"
|
||||
@@ -45,8 +42,7 @@ Our normalized text is 54 characters long, dictating a rectangle with
|
||||
"sroots "
|
||||
```
|
||||
|
||||
The coded message is obtained by reading down the columns going left to
|
||||
right.
|
||||
The coded message is obtained by reading down the columns going left to right.
|
||||
|
||||
The message above is coded as:
|
||||
|
||||
@@ -54,17 +50,14 @@ The message above is coded as:
|
||||
"imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau"
|
||||
```
|
||||
|
||||
Output the encoded text in chunks that fill perfect rectangles `(r X c)`,
|
||||
with `c` chunks of `r` length, separated by spaces. For phrases that are
|
||||
`n` characters short of the perfect rectangle, pad each of the last `n`
|
||||
chunks with a single trailing space.
|
||||
Output the encoded text in chunks that fill perfect rectangles `(r X c)`, with `c` chunks of `r` length, separated by spaces.
|
||||
For phrases that are `n` characters short of the perfect rectangle, pad each of the last `n` chunks with a single trailing space.
|
||||
|
||||
```text
|
||||
"imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau "
|
||||
```
|
||||
|
||||
Notice that were we to stack these, we could visually decode the
|
||||
ciphertext back in to the original message:
|
||||
Notice that were we to stack these, we could visually decode the ciphertext back in to the original message:
|
||||
|
||||
```text
|
||||
"imtgdvs"
|
||||
@@ -75,4 +68,4 @@ ciphertext back in to the original message:
|
||||
"wttddes"
|
||||
"aohghn "
|
||||
"sseoau "
|
||||
```
|
||||
```
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
},
|
||||
"blurb": "Implement the classic method for composing secret messages called a square code.",
|
||||
"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"
|
||||
}
|
||||
|
||||
@@ -1,17 +1,31 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
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
|
||||
throw darts to a [target](https://en.wikipedia.org/wiki/Darts#/media/File:Darts_in_a_dartboard.jpg).
|
||||
[Darts][darts] is a game where players throw darts at a [target][darts-target].
|
||||
|
||||
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).
|
||||
* 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
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
]
|
||||
},
|
||||
"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"
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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.",
|
||||
"authors": ["dwivedirahul44"],
|
||||
"contributors": [
|
||||
"blurb": "Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.",
|
||||
"authors": [
|
||||
"dwivedirahul44"
|
||||
],
|
||||
"contributors": [],
|
||||
"files": {
|
||||
"solution": [
|
||||
"zcl_difference_of_squares.clas.abap"
|
||||
],
|
||||
"files": {
|
||||
"solution": ["zcl_difference_of_squares.clas.abap"],
|
||||
"test": ["zcl_difference_of_squares.clas.testclasses.abap"],
|
||||
"example": [".meta/zcl_difference_of_squares.clas.abap"]
|
||||
},
|
||||
"source": "Problem 6 at Project Euler",
|
||||
"source_url": "http://projecteuler.net/problem=6"
|
||||
}
|
||||
"test": [
|
||||
"zcl_difference_of_squares.clas.testclasses.abap"
|
||||
],
|
||||
"example": [
|
||||
".meta/zcl_difference_of_squares.clas.abap"
|
||||
]
|
||||
},
|
||||
"source": "Problem 6 at Project Euler",
|
||||
"source_url": "https://projecteuler.net/problem=6"
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
".meta/zcl_etl.clas.abap"
|
||||
]
|
||||
},
|
||||
"blurb": "We are going to do the `Transform` step of an Extract-Transform-Load.",
|
||||
"source": "The Jumpstart Lab team",
|
||||
"source_url": "http://jumpstartlab.com"
|
||||
"blurb": "Change the data format for scoring a game to more easily add other languages.",
|
||||
"source": "Based on an exercise by the JumpstartLab team for students at The Turing School of Software and Design.",
|
||||
"source_url": "https://turing.edu"
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
Calculate the number of grains of wheat on a chessboard given that the number
|
||||
on each square doubles.
|
||||
Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.
|
||||
|
||||
There once was a wise servant who saved the life of a prince. The king
|
||||
promised to pay whatever the servant could dream up. Knowing that the
|
||||
king loved chess, the servant told the king he would like to have grains
|
||||
of wheat. One grain on the first square of a chess board, with the number
|
||||
of grains doubling on each successive square.
|
||||
There once was a wise servant who saved the life of a prince.
|
||||
The king promised to pay whatever the servant could dream up.
|
||||
Knowing that the king loved chess, the servant told the king he would like to have grains of wheat.
|
||||
One grain on the first square of a chess board, with the number 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).
|
||||
|
||||
@@ -15,14 +13,3 @@ Write code that shows:
|
||||
|
||||
- how many grains were on a given square, and
|
||||
- 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?
|
||||
@@ -14,6 +14,6 @@
|
||||
]
|
||||
},
|
||||
"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_url": "http://www.javaranch.com/grains.jsp"
|
||||
"source": "The CodeRanch Cattle Drive, Assignment 6",
|
||||
"source_url": "https://coderanch.com/wiki/718824/Grains"
|
||||
}
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
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
|
||||
CATCGTAATGACGGCCT
|
||||
@@ -18,6 +24,4 @@ The Hamming Distance is useful for lots of things in science, not just biology,
|
||||
|
||||
## Implementation notes
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
},
|
||||
"blurb": "Calculate the Hamming difference between two DNA strands.",
|
||||
"source": "The Calculating Point Mutations problem at Rosalind",
|
||||
"source_url": "http://rosalind.info/problems/hamm/"
|
||||
"source_url": "https://rosalind.info/problems/hamm/"
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
# 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
|
||||
the traditional first program for beginning programming in a new language
|
||||
or environment.
|
||||
["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment.
|
||||
|
||||
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.
|
||||
- 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
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
".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_url": "http://en.wikipedia.org/wiki/%22Hello,_world!%22_program"
|
||||
"source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
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.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
Determine if a word or phrase is an isogram.
|
||||
|
||||
@@ -11,4 +11,4 @@ Examples of isograms:
|
||||
- downstream
|
||||
- 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.
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
".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_url": "https://en.wikipedia.org/wiki/Isogram"
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
Given a diagram, determine which plants each child in the kindergarten class is
|
||||
responsible for.
|
||||
|
||||
The kindergarten class is learning about growing plants. The teacher
|
||||
thought it would be a good idea to give them actual seeds, plant them in
|
||||
actual dirt, and grow actual plants.
|
||||
The kindergarten class is learning about growing plants.
|
||||
The teacher thought it would be a good idea to give them actual seeds, plant them in actual dirt, and grow actual plants.
|
||||
|
||||
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,
|
||||
- Ileana, Joseph, Kincaid, and Larry.
|
||||
|
||||
Each child gets 4 cups, two on each row. Their teacher assigns cups to
|
||||
the children alphabetically by their names.
|
||||
Each child gets 4 cups, two on each row.
|
||||
Their teacher assigns cups to the children alphabetically by their names.
|
||||
|
||||
The following diagram represents Alice's plants:
|
||||
|
||||
@@ -36,12 +35,11 @@ VR......................
|
||||
RG......................
|
||||
```
|
||||
|
||||
In the first row, nearest the windows, she has a violet and a radish. In the
|
||||
second row she has a radish and some grass.
|
||||
In the first row, nearest the windows, she has a violet and a radish.
|
||||
In the second row she has a radish and some grass.
|
||||
|
||||
Your program will be given the plants from left-to-right starting with
|
||||
the row nearest the windows. From this, it should be able to determine
|
||||
which plants belong to each student.
|
||||
Your program will be given the plants from left-to-right starting with the row nearest the windows.
|
||||
From this, it should be able to determine which plants belong to each student.
|
||||
|
||||
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:
|
||||
|
||||
- Clover, grass, clover, clover
|
||||
- Clover, grass, clover, clover
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
]
|
||||
},
|
||||
"blurb": "Given a diagram, determine which plants each child in the kindergarten class is responsible for.",
|
||||
"source": "Random musings during airplane trip.",
|
||||
"source_url": "http://jumpstartlab.com"
|
||||
"source": "Exercise by the JumpstartLab team for students at The Turing School of Software and Design.",
|
||||
"source_url": "https://turing.edu"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
For example, 1997 is not a leap year, but 1996 is. 1900 is not a leap
|
||||
year, but 2000 is.
|
||||
For example, 1997 is not a leap year, but 1996 is.
|
||||
1900 is not a leap year, but 2000 is.
|
||||
|
||||
## Notes
|
||||
|
||||
Though our exercise adopts some very simple rules, there is more to
|
||||
learn!
|
||||
Though our exercise adopts some very simple rules, there is more to learn!
|
||||
|
||||
For a delightful, four minute explanation of the whole leap year
|
||||
phenomenon, go watch [this youtube video][video].
|
||||
For a delightful, four minute explanation of the whole leap year phenomenon, go watch [this youtube video][video].
|
||||
|
||||
[video]: http://www.youtube.com/watch?v=xX96xng7sAE
|
||||
[video]: https://www.youtube.com/watch?v=xX96xng7sAE
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
]
|
||||
},
|
||||
"blurb": "Given a year, report if it is a leap year.",
|
||||
"source": "JavaRanch Cattle Drive, exercise 3",
|
||||
"source_url": "http://www.javaranch.com/leap.jsp"
|
||||
"source": "CodeRanch Cattle Drive, Assignment 3",
|
||||
"source_url": "https://coderanch.com/t/718816/Leap"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
Given a string representing a matrix of numbers, return the rows and columns of
|
||||
that matrix.
|
||||
Given a string representing a matrix of numbers, return the rows and columns of that matrix.
|
||||
|
||||
So given a string with embedded newlines like:
|
||||
|
||||
@@ -23,10 +22,8 @@ representing this matrix:
|
||||
|
||||
your code should be able to spit out:
|
||||
|
||||
- A list of the rows, reading each row left-to-right while moving
|
||||
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 rows, reading each row left-to-right while moving top-to-bottom across the rows,
|
||||
- A list of the columns, reading each column top-to-bottom while moving from left-to-right.
|
||||
|
||||
The rows for our example matrix:
|
||||
|
||||
@@ -38,4 +35,4 @@ And its columns:
|
||||
|
||||
- 9, 5, 6
|
||||
- 8, 3, 6
|
||||
- 7, 2, 7
|
||||
- 7, 2, 7
|
||||
|
||||
@@ -14,5 +14,6 @@
|
||||
]
|
||||
},
|
||||
"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."
|
||||
}
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
Add the mine counts to a completed Minesweeper board.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
The board is a rectangle composed of blank space (' ') characters. A mine
|
||||
is represented by an asterisk ('\*') character.
|
||||
The board is a rectangle composed of blank space (' ') characters.
|
||||
A mine is represented by an asterisk (`*`) character.
|
||||
|
||||
If a given space has no adjacent mines at all, leave that square blank.
|
||||
|
||||
## Examples
|
||||
|
||||
For example you may receive a 5 x 4 board like this (empty spaces are
|
||||
represented here with the '·' character for display on screen):
|
||||
For example you may receive a 5 x 4 board like this (empty spaces are represented here with the '·' character for display on screen):
|
||||
|
||||
```text
|
||||
·*·*·
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
".meta/zcl_minesweeper.clas.abap"
|
||||
]
|
||||
},
|
||||
"blurb": "Add the numbers to a minesweeper board"
|
||||
"blurb": "Add the numbers to a minesweeper board."
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
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
|
||||
the 6th prime is 13.
|
||||
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
|
||||
|
||||
If your language provides methods in the standard library to deal with prime
|
||||
numbers, pretend they don't exist and implement them yourself.
|
||||
If your language provides methods in the standard library to deal with prime numbers, pretend they don't exist and implement them yourself.
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
},
|
||||
"blurb": "Given a number n, determine what the nth prime is.",
|
||||
"source": "A variation on Problem 7 at Project Euler",
|
||||
"source_url": "http://projecteuler.net/problem=7"
|
||||
"source_url": "https://projecteuler.net/problem=7"
|
||||
}
|
||||
|
||||
@@ -2,19 +2,23 @@
|
||||
|
||||
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
|
||||
|
||||
```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.
|
||||
|
||||
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
|
||||
|
||||
@@ -27,4 +31,4 @@ should all produce the output
|
||||
|
||||
`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.
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
]
|
||||
},
|
||||
"blurb": "Clean up user-entered phone numbers so that they can be sent SMS messages.",
|
||||
"source": "Event Manager by JumpstartLab",
|
||||
"source_url": "http://tutorials.jumpstartlab.com/projects/eventmanager.html"
|
||||
"source": "Exercise by the JumpstartLab team for students at The Turing School of Software and Design.",
|
||||
"source_url": "https://turing.edu"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
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?
|
||||
|
||||
- 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 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 does not go cleanly into 5. The next possible factor is 4.
|
||||
- 4 does not go cleanly into 5. The next possible factor is 5.
|
||||
- 3 does not go cleanly into 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.
|
||||
- We're left only with 1, so now, we're done.
|
||||
|
||||
Our successful divisors in that computation represent the list of prime
|
||||
factors of 60: 2, 2, 3, and 5.
|
||||
Our successful divisors in that computation represent the list of prime factors of 60: 2, 2, 3, and 5.
|
||||
|
||||
You can check this yourself:
|
||||
|
||||
- 2 \* 2 \* 3 * 5
|
||||
- = 4 * 15
|
||||
- = 60
|
||||
- Success!
|
||||
```text
|
||||
2 * 2 * 3 * 5
|
||||
= 4 * 15
|
||||
= 60
|
||||
```
|
||||
|
||||
Success!
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
},
|
||||
"blurb": "Compute the prime factors of a given natural number.",
|
||||
"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"
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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".
|
||||
- 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
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
".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.",
|
||||
"source_url": "https://github.com/exercism/problem-specifications/blob/main/exercises/raindrops/description.md"
|
||||
"blurb": "Convert a number to a string, the content of which depends on the number's factors.",
|
||||
"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."
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
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:
|
||||
@@ -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 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
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
".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_url": "https://github.com/exercism/problem-specifications/issues/1458"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Instructions
|
||||
|
||||
Reverse a string.
|
||||
Reverse a string
|
||||
|
||||
For example:
|
||||
* input: `cool`
|
||||
* output: `looc`
|
||||
input: "cool"
|
||||
output: "looc"
|
||||
|
||||
@@ -13,5 +13,7 @@
|
||||
".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"
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
Implement run-length encoding and decoding.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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"
|
||||
```
|
||||
|
||||
RLE allows the original data to be perfectly reconstructed from
|
||||
the compressed data, which makes it a lossless data compression.
|
||||
RLE allows the original data to be perfectly reconstructed from the compressed data, which makes it a lossless data compression.
|
||||
|
||||
```text
|
||||
"AABCCCDEEEE" -> "2AB3CD4E" -> "AABCCCDEEEE"
|
||||
```
|
||||
|
||||
For simplicity, you can assume that the unencoded string will only contain
|
||||
the letters A through Z (either lower or upper case) and whitespace. 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.
|
||||
For simplicity, you can assume that the unencoded string will only contain the letters A through Z (either lower or upper case) and whitespace.
|
||||
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.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Description
|
||||
# Instructions
|
||||
|
||||
Given a word, compute the Scrabble score for that word.
|
||||
|
||||
@@ -37,4 +37,4 @@ And to total:
|
||||
## Extensions
|
||||
|
||||
- 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.
|
||||
|
||||
@@ -14,5 +14,6 @@
|
||||
]
|
||||
},
|
||||
"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"
|
||||
}
|
||||
|
||||
@@ -43,5 +43,6 @@ jump, double blink
|
||||
|
||||
~~~~exercism/note
|
||||
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
|
||||
~~~~
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
},
|
||||
"blurb": "Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.",
|
||||
"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"
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ One for you, one for me.
|
||||
|
||||
Here are some examples:
|
||||
|
||||
|Name |Dialogue
|
||||
|:-------|:------------------
|
||||
|Alice |One for Alice, one for me.
|
||||
|Bohdan |One for Bohdan, one for me.
|
||||
| |One for you, one for me.
|
||||
|Zaphod |One for Zaphod, one for me.
|
||||
| Name | Dialogue |
|
||||
| :----- | :-------------------------- |
|
||||
| Alice | One for Alice, one for me. |
|
||||
| Bohdan | One for Bohdan, one for me. |
|
||||
| | One for you, one for me. |
|
||||
| Zaphod | One for Zaphod, one for me. |
|
||||
|
||||
@@ -14,6 +14,5 @@
|
||||
]
|
||||
},
|
||||
"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_url": "https://github.com/exercism/javascript/tree/main/exercises/practice/word-count"
|
||||
"source": "This is a classic toy problem, but we were reminded of it by seeing it in the Go Tour."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user