Skip to content

Commit bcbffa5

Browse files
authored
Sync docs and metadata (#195)
1 parent fd258c8 commit bcbffa5

File tree

10 files changed

+100
-56
lines changed

10 files changed

+100
-56
lines changed
Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
# Instructions
22

3-
Your task is to convert a number into a string that contains raindrop sounds corresponding to certain potential factors.
4-
A factor is a number that evenly divides into another number, leaving no remainder.
5-
The simplest way to test if one number is a factor of another is to use the [modulo operation][modulo].
3+
Your task is to convert a number into its corresponding raindrop sounds.
64

7-
The rules of `raindrops` are that if a given number:
5+
If a given number:
86

9-
- has 3 as a factor, add 'Pling' to the result.
10-
- has 5 as a factor, add 'Plang' to the result.
11-
- has 7 as a factor, add 'Plong' to the result.
12-
- _does not_ have any of 3, 5, or 7 as a factor, the result should be the digits of the number.
7+
- is divisible by 3, add "Pling" to the result.
8+
- is divisible by 5, add "Plang" to the result.
9+
- is divisible by 7, add "Plong" to the result.
10+
- **is not** divisible by 3, 5, or 7, the result should be the number as a string.
1311

1412
## Examples
1513

16-
- 28 has 7 as a factor, but not 3 or 5, so the result would be "Plong".
17-
- 30 has both 3 and 5 as factors, but not 7, so the result would be "PlingPlang".
18-
- 34 is not factored by 3, 5, or 7, so the result would be "34".
14+
- 28 is divisible by 7, but not 3 or 5, so the result would be `"Plong"`.
15+
- 30 is divisible by 3 and 5, but not 7, so the result would be `"PlingPlang"`.
16+
- 34 is not divisible by 3, 5, or 7, so the result would be `"34"`.
1917

18+
~~~~exercism/note
19+
A common way to test if one number is evenly divisible by another is to compare the [remainder][remainder] or [modulus][modulo] to zero.
20+
Most languages provide operators or functions for one (or both) of these.
21+
22+
[remainder]: https://exercism.org/docs/programming/operators/remainder
2023
[modulo]: https://en.wikipedia.org/wiki/Modulo_operation
24+
~~~~
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Introduction
2+
3+
Raindrops is a slightly more complex version of the FizzBuzz challenge, a classic interview question.

exercises/practice/raindrops/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
".meta/example.arr"
1414
]
1515
},
16-
"blurb": "Convert a number to a string, the content of which depends on the number's factors.",
16+
"blurb": "Convert a number into its corresponding raindrop sounds - Pling, Plang and Plong.",
1717
"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.",
1818
"source_url": "https://en.wikipedia.org/wiki/Fizz_buzz"
1919
}
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Instructions
22

3-
Reverse a string
3+
Your task is to reverse a given string.
44

5-
For example:
6-
input: "cool"
7-
output: "looc"
5+
Some examples:
6+
7+
- Turn `"stressed"` into `"desserts"`.
8+
- Turn `"strops"` into `"sports"`.
9+
- Turn `"racecar"` into `"racecar"`.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Introduction
2+
3+
Reversing strings (reading them from right to left, rather than from left to right) is a surprisingly common task in programming.
4+
5+
For example, in bioinformatics, reversing the sequence of DNA or RNA strings is often important for various analyses, such as finding complementary strands or identifying palindromic sequences that have biological significance.

exercises/practice/reverse-string/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
".meta/example.arr"
1414
]
1515
},
16-
"blurb": "Reverse a string.",
16+
"blurb": "Reverse a given string.",
1717
"source": "Introductory challenge to reverse an input string",
1818
"source_url": "https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb"
1919
}
Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,12 @@
1-
# Instructions
1+
# Introduction
22

3-
Write a function to convert from normal numbers to Roman Numerals.
3+
Your task is to convert a number from Arabic numerals to Roman numerals.
44

5-
The Romans were a clever bunch.
6-
They conquered most of Europe and ruled it for hundreds of years.
7-
They invented concrete and straight roads and even bikinis.
8-
One thing they never discovered though was the number zero.
9-
This made writing and dating extensive histories of their exploits slightly more challenging, but the system of numbers they came up with is still in use today.
10-
For example the BBC uses Roman numerals to date their programs.
5+
For this exercise, we are only concerned about traditional Roman numerals, in which the largest number is MMMCMXCIX (or 3,999).
116

12-
The Romans wrote numbers using letters - I, V, X, L, C, D, M.
13-
(notice these letters have lots of straight lines and are hence easy to hack into stone tablets).
7+
~~~~exercism/note
8+
There are lots of different ways to convert between Arabic and Roman numerals.
9+
We recommend taking a naive approach first to familiarise yourself with the concept of Roman numerals and then search for more efficient methods.
1410
15-
```text
16-
1 => I
17-
10 => X
18-
7 => VII
19-
```
20-
21-
The maximum number supported by this notation is 3,999.
22-
(The Romans themselves didn't tend to go any higher)
23-
24-
Wikipedia says: Modern Roman numerals ... are written by expressing each digit separately starting with the left most digit and skipping any digit with a value of zero.
25-
26-
To see this in practice, consider the example of 1990.
27-
28-
In Roman numerals 1990 is MCMXC:
29-
30-
1000=M
31-
900=CM
32-
90=XC
33-
34-
2008 is written as MMVIII:
35-
36-
2000=MM
37-
8=VIII
38-
39-
Learn more about [Roman numerals on Wikipedia][roman-numerals].
40-
41-
[roman-numerals]: https://wiki.imperivm-romanvm.com/wiki/Roman_Numerals
11+
Make sure to check out our Deep Dive video at the end to explore the different approaches you can take!
12+
~~~~
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Description
2+
3+
Today, most people in the world use Arabic numerals (0–9).
4+
But if you travelled back two thousand years, you'd find that most Europeans were using Roman numerals instead.
5+
6+
To write a Roman numeral we use the following Latin letters, each of which has a value:
7+
8+
| M | D | C | L | X | V | I |
9+
| ---- | --- | --- | --- | --- | --- | --- |
10+
| 1000 | 500 | 100 | 50 | 10 | 5 | 1 |
11+
12+
A Roman numeral is a sequence of these letters, and its value is the sum of the letters' values.
13+
For example, `XVIII` has the value 18 (`10 + 5 + 1 + 1 + 1 = 18`).
14+
15+
There's one rule that makes things trickier though, and that's that **the same letter cannot be used more than three times in succession**.
16+
That means that we can't express numbers such as 4 with the seemingly natural `IIII`.
17+
Instead, for those numbers, we use a subtraction method between two letters.
18+
So we think of `4` not as `1 + 1 + 1 + 1` but instead as `5 - 1`.
19+
And slightly confusingly to our modern thinking, we write the smaller number first.
20+
This applies only in the following cases: 4 (`IV`), 9 (`IX`), 40 (`XL`), 90 (`XC`), 400 (`CD`) and 900 (`CM`).
21+
22+
Order matters in Roman numerals!
23+
Letters (and the special compounds above) must be ordered by decreasing value from left to right.
24+
25+
Here are some examples:
26+
27+
```text
28+
105 => CV
29+
---- => --
30+
100 => C
31+
+ 5 => V
32+
```
33+
34+
```text
35+
106 => CVI
36+
---- => --
37+
100 => C
38+
+ 5 => V
39+
+ 1 => I
40+
```
41+
42+
```text
43+
104 => CIV
44+
---- => ---
45+
100 => C
46+
+ 4 => IV
47+
```
48+
49+
And a final more complex example:
50+
51+
```text
52+
1996 => MCMXCVI
53+
----- => -------
54+
1000 => M
55+
+ 900 => CM
56+
+ 90 => XC
57+
+ 5 => V
58+
+ 1 => I
59+
```

exercises/practice/roman-numerals/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
".meta/example.arr"
1414
]
1515
},
16-
"blurb": "Write a function to convert from normal numbers to Roman Numerals.",
16+
"blurb": "Convert modern Arabic numbers into Roman numerals.",
1717
"source": "The Roman Numeral Kata",
1818
"source_url": "https://codingdojo.org/kata/RomanNumerals/"
1919
}

exercises/practice/strain/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
".meta/example.arr"
1414
]
1515
},
16-
"blurb": "Implement the `keep` and `discard` operation on collections. Given a collection and a predicate on the collection's elements, `keep` returns a new collection containing those elements where the predicate is true, while `discard` returns a new collection containing those elements where the predicate is false.",
16+
"blurb": "Implement the `keep` and `discard` operation on collections.",
1717
"source": "Conversation with James Edward Gray II",
1818
"source_url": "http://graysoftinc.com/"
1919
}

0 commit comments

Comments
 (0)