trackler 2.2.1.85 → 2.2.1.86
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/alphametics/canonical-data.json +29 -11
- data/problem-specifications/exercises/binary-search-tree/canonical-data.json +177 -0
- data/problem-specifications/package.json +2 -2
- data/problem-specifications/yarn.lock +61 -51
- data/tracks/bash/CONTRIBUTING.md +10 -6
- data/tracks/bash/README.md +1 -0
- data/tracks/bash/exercises/acronym/README.md +1 -1
- data/tracks/bash/exercises/anagram/README.md +1 -1
- data/tracks/bash/exercises/anagram/{anagram_tests.sh → anagram_test.sh} +0 -0
- data/tracks/bash/exercises/armstrong-numbers/armstrong_numbers_test.sh +25 -17
- data/tracks/bash/exercises/armstrong-numbers/example.sh +18 -12
- data/tracks/bash/exercises/atbash-cipher/README.md +1 -1
- data/tracks/bash/exercises/atbash-cipher/{atbash_cipher_tests.sh → atbash_cipher_test.sh} +0 -0
- data/tracks/bash/exercises/difference-of-squares/README.md +1 -1
- data/tracks/bash/exercises/gigasecond/README.md +1 -1
- data/tracks/bash/exercises/hamming/README.md +1 -1
- data/tracks/bash/exercises/hello-world/README.md +1 -1
- data/tracks/bash/exercises/leap/README.md +1 -1
- data/tracks/bash/exercises/luhn/README.md +1 -1
- data/tracks/bash/exercises/nucleotide-count/README.md +1 -1
- data/tracks/bash/exercises/pangram/README.md +1 -1
- data/tracks/bash/exercises/pangram/{pangram_tests.sh → pangram_test.sh} +0 -0
- data/tracks/bash/exercises/phone-number/README.md +1 -1
- data/tracks/bash/exercises/phone-number/{phone_number_tests.sh → phone_number_test.sh} +0 -0
- data/tracks/bash/exercises/raindrops/README.md +1 -1
- data/tracks/bash/exercises/rna-transcription/README.md +1 -1
- data/tracks/bash/exercises/triangle/example.sh +23 -4
- data/tracks/bash/exercises/triangle/triangle_test.sh +17 -0
- data/tracks/bash/exercises/two-fer/README.md +1 -1
- data/tracks/bash/exercises/word-count/README.md +1 -1
- data/tracks/c/config.json +11 -0
- data/tracks/c/exercises/complex-numbers/README.md +67 -0
- data/tracks/c/exercises/complex-numbers/makefile +27 -0
- data/tracks/c/exercises/complex-numbers/src/complex_numbers.c +46 -0
- data/tracks/c/exercises/complex-numbers/src/complex_numbers.h +19 -0
- data/tracks/c/exercises/complex-numbers/src/example.c +80 -0
- data/tracks/c/exercises/complex-numbers/test/test_complex_numbers.c +397 -0
- data/tracks/c/exercises/complex-numbers/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/complex-numbers/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/complex-numbers/test/vendor/unity_internals.h +701 -0
- data/tracks/crystal/.github/stale.yml +18 -0
- data/tracks/csharp/exercises/bob/README.md +3 -2
- data/tracks/ecmascript/config.json +4 -4
- data/tracks/fsharp/exercises/bob/README.md +4 -2
- data/tracks/fsharp/exercises/react/ReactTest.fs +137 -74
- data/tracks/fsharp/generators/Generators.fs +76 -0
- data/tracks/go/exercises/tree-building/tree_test.go +15 -0
- data/tracks/haskell/.travis.yml +1 -1
- data/tracks/haskell/exercises/accumulate/stack.yaml +1 -1
- data/tracks/haskell/exercises/acronym/package.yaml +1 -1
- data/tracks/haskell/exercises/acronym/stack.yaml +1 -1
- data/tracks/haskell/exercises/all-your-base/package.yaml +1 -1
- data/tracks/haskell/exercises/all-your-base/stack.yaml +1 -1
- data/tracks/haskell/exercises/all-your-base/test/Tests.hs +6 -6
- data/tracks/haskell/exercises/allergies/package.yaml +1 -1
- data/tracks/haskell/exercises/allergies/stack.yaml +1 -1
- data/tracks/haskell/exercises/alphametics/stack.yaml +1 -1
- data/tracks/haskell/exercises/anagram/package.yaml +1 -1
- data/tracks/haskell/exercises/anagram/stack.yaml +1 -1
- data/tracks/haskell/exercises/atbash-cipher/package.yaml +1 -1
- data/tracks/haskell/exercises/atbash-cipher/stack.yaml +1 -1
- data/tracks/haskell/exercises/bank-account/stack.yaml +1 -1
- data/tracks/haskell/exercises/beer-song/stack.yaml +1 -1
- data/tracks/haskell/exercises/binary-search-tree/package.yaml +1 -1
- data/tracks/haskell/exercises/binary-search-tree/stack.yaml +1 -1
- data/tracks/haskell/exercises/binary-search-tree/test/Tests.hs +3 -0
- data/tracks/haskell/exercises/binary/stack.yaml +1 -1
- data/tracks/haskell/exercises/bob/package.yaml +1 -1
- data/tracks/haskell/exercises/bob/stack.yaml +1 -1
- data/tracks/haskell/exercises/bowling/stack.yaml +1 -1
- data/tracks/haskell/exercises/bracket-push/package.yaml +1 -1
- data/tracks/haskell/exercises/bracket-push/stack.yaml +1 -1
- data/tracks/haskell/exercises/change/package.yaml +1 -1
- data/tracks/haskell/exercises/change/stack.yaml +1 -1
- data/tracks/haskell/exercises/clock/stack.yaml +1 -1
- data/tracks/haskell/exercises/collatz-conjecture/package.yaml +1 -1
- data/tracks/haskell/exercises/collatz-conjecture/stack.yaml +1 -1
- data/tracks/haskell/exercises/complex-numbers/stack.yaml +1 -1
- data/tracks/haskell/exercises/connect/package.yaml +1 -1
- data/tracks/haskell/exercises/connect/stack.yaml +1 -1
- data/tracks/haskell/exercises/crypto-square/package.yaml +1 -1
- data/tracks/haskell/exercises/crypto-square/stack.yaml +1 -1
- data/tracks/haskell/exercises/custom-set/stack.yaml +1 -1
- data/tracks/haskell/exercises/diamond/package.yaml +1 -1
- data/tracks/haskell/exercises/diamond/stack.yaml +1 -1
- data/tracks/haskell/exercises/difference-of-squares/package.yaml +1 -1
- data/tracks/haskell/exercises/difference-of-squares/stack.yaml +1 -1
- data/tracks/haskell/exercises/dominoes/package.yaml +1 -1
- data/tracks/haskell/exercises/dominoes/stack.yaml +1 -1
- data/tracks/haskell/exercises/etl/stack.yaml +1 -1
- data/tracks/haskell/exercises/food-chain/stack.yaml +1 -1
- data/tracks/haskell/exercises/forth/stack.yaml +1 -1
- data/tracks/haskell/exercises/gigasecond/stack.yaml +1 -1
- data/tracks/haskell/exercises/go-counting/stack.yaml +1 -1
- data/tracks/haskell/exercises/grade-school/stack.yaml +1 -1
- data/tracks/haskell/exercises/grains/stack.yaml +1 -1
- data/tracks/haskell/exercises/hamming/stack.yaml +1 -1
- data/tracks/haskell/exercises/hello-world/stack.yaml +1 -1
- data/tracks/haskell/exercises/hexadecimal/stack.yaml +1 -1
- data/tracks/haskell/exercises/house/stack.yaml +1 -1
- data/tracks/haskell/exercises/isbn-verifier/examples/success-standard/src/IsbnVerifier.hs +1 -0
- data/tracks/haskell/exercises/isbn-verifier/package.yaml +1 -1
- data/tracks/haskell/exercises/isbn-verifier/stack.yaml +1 -1
- data/tracks/haskell/exercises/isbn-verifier/test/Tests.hs +4 -0
- data/tracks/haskell/exercises/isogram/stack.yaml +1 -1
- data/tracks/haskell/exercises/kindergarten-garden/stack.yaml +1 -1
- data/tracks/haskell/exercises/largest-series-product/stack.yaml +1 -1
- data/tracks/haskell/exercises/leap/stack.yaml +1 -1
- data/tracks/haskell/exercises/lens-person/stack.yaml +1 -1
- data/tracks/haskell/exercises/linked-list/stack.yaml +1 -1
- data/tracks/haskell/exercises/list-ops/stack.yaml +1 -1
- data/tracks/haskell/exercises/luhn/package.yaml +1 -1
- data/tracks/haskell/exercises/luhn/stack.yaml +1 -1
- data/tracks/haskell/exercises/luhn/test/Tests.hs +1 -1
- data/tracks/haskell/exercises/matrix/stack.yaml +1 -1
- data/tracks/haskell/exercises/meetup/package.yaml +1 -1
- data/tracks/haskell/exercises/meetup/stack.yaml +1 -1
- data/tracks/haskell/exercises/minesweeper/stack.yaml +1 -1
- data/tracks/haskell/exercises/nth-prime/stack.yaml +1 -1
- data/tracks/haskell/exercises/nucleotide-count/stack.yaml +1 -1
- data/tracks/haskell/exercises/ocr-numbers/stack.yaml +1 -1
- data/tracks/haskell/exercises/octal/stack.yaml +1 -1
- data/tracks/haskell/exercises/palindrome-products/stack.yaml +1 -1
- data/tracks/haskell/exercises/pangram/stack.yaml +1 -1
- data/tracks/haskell/exercises/parallel-letter-frequency/stack.yaml +1 -1
- data/tracks/haskell/exercises/pascals-triangle/stack.yaml +1 -1
- data/tracks/haskell/exercises/perfect-numbers/stack.yaml +1 -1
- data/tracks/haskell/exercises/phone-number/stack.yaml +1 -1
- data/tracks/haskell/exercises/pig-latin/stack.yaml +1 -1
- data/tracks/haskell/exercises/pov/stack.yaml +1 -1
- data/tracks/haskell/exercises/prime-factors/stack.yaml +1 -1
- data/tracks/haskell/exercises/pythagorean-triplet/stack.yaml +1 -1
- data/tracks/haskell/exercises/queen-attack/stack.yaml +1 -1
- data/tracks/haskell/exercises/rail-fence-cipher/package.yaml +1 -1
- data/tracks/haskell/exercises/rail-fence-cipher/stack.yaml +1 -1
- data/tracks/haskell/exercises/raindrops/stack.yaml +1 -1
- data/tracks/haskell/exercises/rna-transcription/package.yaml +1 -1
- data/tracks/haskell/exercises/rna-transcription/stack.yaml +1 -1
- data/tracks/haskell/exercises/rna-transcription/test/Tests.hs +0 -12
- data/tracks/haskell/exercises/robot-name/stack.yaml +1 -1
- data/tracks/haskell/exercises/robot-simulator/stack.yaml +1 -1
- data/tracks/haskell/exercises/roman-numerals/stack.yaml +1 -1
- data/tracks/haskell/exercises/rotational-cipher/stack.yaml +1 -1
- data/tracks/haskell/exercises/run-length-encoding/stack.yaml +1 -1
- data/tracks/haskell/exercises/saddle-points/stack.yaml +1 -1
- data/tracks/haskell/exercises/say/stack.yaml +1 -1
- data/tracks/haskell/exercises/scrabble-score/stack.yaml +1 -1
- data/tracks/haskell/exercises/secret-handshake/stack.yaml +1 -1
- data/tracks/haskell/exercises/series/stack.yaml +1 -1
- data/tracks/haskell/exercises/sgf-parsing/stack.yaml +1 -1
- data/tracks/haskell/exercises/sieve/stack.yaml +1 -1
- data/tracks/haskell/exercises/simple-cipher/stack.yaml +1 -1
- data/tracks/haskell/exercises/simple-linked-list/stack.yaml +1 -1
- data/tracks/haskell/exercises/space-age/stack.yaml +1 -1
- data/tracks/haskell/exercises/spiral-matrix/stack.yaml +1 -1
- data/tracks/haskell/exercises/strain/stack.yaml +1 -1
- data/tracks/haskell/exercises/sublist/stack.yaml +1 -1
- data/tracks/haskell/exercises/sum-of-multiples/stack.yaml +1 -1
- data/tracks/haskell/exercises/triangle/stack.yaml +1 -1
- data/tracks/haskell/exercises/trinary/stack.yaml +1 -1
- data/tracks/haskell/exercises/twelve-days/stack.yaml +1 -1
- data/tracks/haskell/exercises/word-count/stack.yaml +1 -1
- data/tracks/haskell/exercises/wordy/stack.yaml +1 -1
- data/tracks/haskell/exercises/zebra-puzzle/stack.yaml +1 -1
- data/tracks/haskell/exercises/zipper/stack.yaml +1 -1
- data/tracks/java/config.json +12 -0
- data/tracks/java/exercises/alphametics/.meta/src/reference/java/Alphametics.java +125 -0
- data/tracks/java/exercises/alphametics/.meta/src/reference/java/UnsolvablePuzzleException.java +2 -0
- data/tracks/java/exercises/alphametics/.meta/src/version +1 -0
- data/tracks/java/exercises/alphametics/README.md +47 -0
- data/tracks/java/exercises/alphametics/build.gradle +18 -0
- data/tracks/java/exercises/alphametics/src/main/java/.keep +0 -0
- data/tracks/java/exercises/alphametics/src/main/java/UnsolvablePuzzleException.java +2 -0
- data/tracks/java/exercises/alphametics/src/test/java/AlphameticsTest.java +150 -0
- data/tracks/java/exercises/beer-song/.meta/src/reference/java/BeerSong.java +5 -4
- data/tracks/java/exercises/beer-song/.meta/version +1 -0
- data/tracks/java/exercises/beer-song/src/test/java/BeerSongTest.java +24 -16
- data/tracks/java/exercises/binary-search/.meta/version +1 -0
- data/tracks/java/exercises/book-store/.meta/version +1 -0
- data/tracks/java/exercises/book-store/src/test/java/BookStoreTest.java +15 -8
- data/tracks/java/exercises/circular-buffer/.meta/version +1 -0
- data/tracks/java/exercises/list-ops/.meta/version +1 -1
- data/tracks/java/exercises/list-ops/src/test/java/ListOpsTest.java +1 -1
- data/tracks/java/exercises/nth-prime/.meta/version +1 -0
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/java/exercises/tournament/.meta/version +1 -0
- data/tracks/java/exercises/transpose/.meta/version +1 -0
- data/tracks/java/exercises/transpose/src/test/java/TransposeTest.java +29 -74
- data/tracks/java/exercises/wordy/.meta/version +1 -0
- data/tracks/javascript/.eslintignore +0 -1
- data/tracks/javascript/config.json +13 -3
- data/tracks/javascript/exercises/bowling/example.js +24 -10
- data/tracks/javascript/exercises/forth/README.md +56 -0
- data/tracks/javascript/exercises/forth/example.js +66 -0
- data/tracks/javascript/exercises/forth/forth.spec.js +259 -0
- data/tracks/lua/config.json +92 -81
- data/tracks/lua/exercises/accumulate/README.md +42 -0
- data/tracks/lua/exercises/beer-song/README.md +1 -1
- data/tracks/lua/exercises/bob/README.md +2 -0
- data/tracks/lua/exercises/crypto-square/README.md +6 -4
- data/tracks/lua/exercises/house/README.md +1 -1
- data/tracks/lua/exercises/isbn-verifier/README.md +25 -20
- data/tracks/lua/exercises/kindergarten-garden/README.md +3 -3
- data/tracks/lua/exercises/meetup/README.md +16 -12
- data/tracks/lua/exercises/nucleotide-count/README.md +2 -2
- data/tracks/lua/exercises/phone-number/README.md +1 -1
- data/tracks/lua/exercises/pov/README.md +0 -2
- data/tracks/lua/exercises/queen-attack/README.md +22 -22
- data/tracks/lua/exercises/rectangles/README.md +9 -9
- data/tracks/lua/exercises/reverse-string/README.md +23 -0
- data/tracks/lua/exercises/reverse-string/example.lua +7 -0
- data/tracks/lua/exercises/reverse-string/reverse-string_spec.lua +24 -0
- data/tracks/lua/exercises/secret-handshake/README.md +1 -1
- data/tracks/lua/exercises/space-age/README.md +1 -2
- data/tracks/lua/exercises/sum-of-multiples/README.md +3 -3
- data/tracks/perl6/exercises/two-fer/README.md +1 -1
- data/tracks/python/exercises/luhn/luhn_test.py +1 -1
- metadata +39 -6
@@ -0,0 +1,42 @@
|
|
1
|
+
# Accumulate
|
2
|
+
|
3
|
+
Implement the `accumulate` operation, which, given a collection and an
|
4
|
+
operation to perform on each element of the collection, returns a new
|
5
|
+
collection containing the result of applying that operation to each element of
|
6
|
+
the input collection.
|
7
|
+
|
8
|
+
Given the collection of numbers:
|
9
|
+
|
10
|
+
- 1, 2, 3, 4, 5
|
11
|
+
|
12
|
+
And the operation:
|
13
|
+
|
14
|
+
- square a number (`x => x * x`)
|
15
|
+
|
16
|
+
Your code should be able to produce the collection of squares:
|
17
|
+
|
18
|
+
- 1, 4, 9, 16, 25
|
19
|
+
|
20
|
+
Check out the test suite to see the expected function signature.
|
21
|
+
|
22
|
+
## Restrictions
|
23
|
+
|
24
|
+
Keep your hands off that collect/map/fmap/whatchamacallit functionality
|
25
|
+
provided by your standard library!
|
26
|
+
Solve this one yourself using other basic tools instead.
|
27
|
+
|
28
|
+
## Running the tests
|
29
|
+
|
30
|
+
To run the tests, run the command `busted .` from within the exercise directory.
|
31
|
+
|
32
|
+
## Further information
|
33
|
+
|
34
|
+
For more detailed information about the Lua track, including how to get help if
|
35
|
+
you're having trouble, please visit the exercism.io [Lua language page](http://exercism.io/languages/lua/about).
|
36
|
+
|
37
|
+
## Source
|
38
|
+
|
39
|
+
Conversation with James Edward Gray II [https://twitter.com/jeg2](https://twitter.com/jeg2)
|
40
|
+
|
41
|
+
## Submitting Incomplete Solutions
|
42
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -6,6 +6,8 @@ Bob answers 'Sure.' if you ask him a question.
|
|
6
6
|
|
7
7
|
He answers 'Whoa, chill out!' if you yell at him.
|
8
8
|
|
9
|
+
He answers 'Calm down, I know what I'm doing!' if you yell a question at him.
|
10
|
+
|
9
11
|
He says 'Fine. Be that way!' if you address him without actually saying
|
10
12
|
anything.
|
11
13
|
|
@@ -45,12 +45,14 @@ The message above is coded as:
|
|
45
45
|
imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
|
46
46
|
```
|
47
47
|
|
48
|
-
Output the encoded text in chunks. Phrases that fill perfect
|
49
|
-
`(r X
|
50
|
-
|
48
|
+
Output the encoded text in chunks. Phrases that fill perfect rectangles
|
49
|
+
`(r X c)` should be output `c` chunks of `r` length, separated by spaces.
|
50
|
+
Phrases that do not fill perfect rectangles will have `n` empty spaces.
|
51
|
+
Those spaces should be distributed evenly, added to the end of the last
|
52
|
+
`n` chunks.
|
51
53
|
|
52
54
|
```text
|
53
|
-
imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn
|
55
|
+
imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau
|
54
56
|
```
|
55
57
|
|
56
58
|
Notice that were we to stack these, we could visually decode the
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# House
|
2
2
|
|
3
|
-
|
3
|
+
Recite the nursery rhyme 'This is the House that Jack Built'.
|
4
4
|
|
5
5
|
> [The] process of placing a phrase of clause within another phrase of
|
6
6
|
> clause is called embedding. It is through the processes of recursion
|
@@ -1,40 +1,45 @@
|
|
1
1
|
# Isbn Verifier
|
2
2
|
|
3
|
-
|
3
|
+
The [ISBN-10 verification process](https://en.wikipedia.org/wiki/International_Standard_Book_Number) is used to validate book identification
|
4
|
+
numbers. These normally contain dashes and look like: `3-598-21508-8`
|
4
5
|
|
5
|
-
##
|
6
|
+
## ISBN
|
6
7
|
|
7
|
-
|
8
|
-
Putting this into place requires some thinking about preprocessing/parsing of the string prior to calculating the check digit for the ISBN.
|
8
|
+
The ISBN-10 format is 9 digits (0 to 9) plus one check character (either a digit or an X only). In the case the check character is an X, this represents the value '10'. These may be communicated with or without hyphens, and can be checked for their validity by the following formula:
|
9
9
|
|
10
|
-
|
10
|
+
```
|
11
|
+
(x1 * 10 + x2 * 9 + x3 * 8 + x4 * 7 + x5 * 6 + x6 * 5 + x7 * 4 + x8 * 3 + x9 * 2 + x10 * 1) mod 11 == 0
|
12
|
+
```
|
11
13
|
|
12
|
-
|
14
|
+
If the result is 0, then it is a valid ISBN-10, otherwise it is invalid.
|
15
|
+
|
16
|
+
## Example
|
13
17
|
|
14
|
-
Let's take
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
Let's take the ISBN-10 `3-598-21508-8`. We plug it in to the formula, and get:
|
19
|
+
```
|
20
|
+
(3 * 10 + 5 * 9 + 9 * 8 + 8 * 7 + 2 * 6 + 1 * 5 + 5 * 4 + 0 * 3 + 8 * 2 + 8 * 1) mod 11 == 0
|
21
|
+
```
|
18
22
|
|
19
|
-
|
20
|
-
|
23
|
+
Since the result is 0, this proves that our ISBN is valid.
|
24
|
+
|
25
|
+
## Task
|
26
|
+
|
27
|
+
Given a string the program should check if the provided string is a valid ISBN-10.
|
28
|
+
Putting this into place requires some thinking about preprocessing/parsing of the string prior to calculating the check digit for the ISBN.
|
21
29
|
|
22
|
-
|
23
|
-
So for our example ISBN this means:
|
24
|
-
(3 * 10 + 5 * 9 + 9 * 8 + 8 * 7 + 2 * 6 + 1 * 5 + 5 * 4 + 0 * 3 + 8 * 2 + 8 * 1) mod 11 = 0
|
30
|
+
The program should be able to verify ISBN-10 both with and without separating dashes.
|
25
31
|
|
26
|
-
Which proves that the ISBN is valid.
|
27
32
|
|
28
33
|
## Caveats
|
29
34
|
|
30
|
-
Converting from
|
31
|
-
|
35
|
+
Converting from strings to numbers can be tricky in certain languages.
|
36
|
+
Now, it's even trickier since the check digit of an ISBN-10 may be 'X' (representing '10'). For instance `3-598-21507-X` is a valid ISBN-10.
|
32
37
|
|
33
38
|
## Bonus tasks
|
34
39
|
|
35
|
-
* Generate a valid ISBN-13 from the input ISBN-10 (and maybe verify it again with a derived verifier)
|
40
|
+
* Generate a valid ISBN-13 from the input ISBN-10 (and maybe verify it again with a derived verifier).
|
36
41
|
|
37
|
-
* Generate valid ISBN, maybe even from a given starting ISBN
|
42
|
+
* Generate valid ISBN, maybe even from a given starting ISBN.
|
38
43
|
## Running the tests
|
39
44
|
|
40
45
|
To run the tests, run the command `busted .` from within the exercise directory.
|
@@ -9,8 +9,8 @@ actual dirt, and grow actual plants.
|
|
9
9
|
|
10
10
|
They've chosen to grow grass, clover, radishes, and violets.
|
11
11
|
|
12
|
-
To this end, the children have put little cups along the window sills, and
|
13
|
-
planted one type of plant in each cup, choosing randomly from the available
|
12
|
+
To this end, the children have put little cups along the window sills, and
|
13
|
+
planted one type of plant in each cup, choosing randomly from the available
|
14
14
|
types of seeds.
|
15
15
|
|
16
16
|
```text
|
@@ -25,7 +25,7 @@ There are 12 children in the class:
|
|
25
25
|
- Eve, Fred, Ginny, Harriet,
|
26
26
|
- Ileana, Joseph, Kincaid, and Larry.
|
27
27
|
|
28
|
-
Each child gets 4 cups, two on each row. Their teacher assigns cups to
|
28
|
+
Each child gets 4 cups, two on each row. Their teacher assigns cups to
|
29
29
|
the children alphabetically by their names.
|
30
30
|
|
31
31
|
The following diagram represents Alice's plants:
|
@@ -2,25 +2,29 @@
|
|
2
2
|
|
3
3
|
Calculate the date of meetups.
|
4
4
|
|
5
|
-
Typically meetups happen on the same day of the week. In this exercise, you
|
6
|
-
a description of a meetup date, and return the actual meetup date.
|
5
|
+
Typically meetups happen on the same day of the week. In this exercise, you
|
6
|
+
will take a description of a meetup date, and return the actual meetup date.
|
7
7
|
|
8
8
|
Examples of general descriptions are:
|
9
9
|
|
10
|
-
-
|
11
|
-
-
|
12
|
-
-
|
13
|
-
-
|
10
|
+
- The first Monday of January 2017
|
11
|
+
- The third Tuesday of January 2017
|
12
|
+
- The wednesteenth of January 2017
|
13
|
+
- The last Thursday of January 2017
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
The descriptors you are expected to parse are:
|
16
|
+
first, second, third, fourth, fifth, last, monteenth, tuesteenth, wednesteenth,
|
17
|
+
thursteenth, friteenth, saturteenth, sunteenth
|
18
|
+
|
19
|
+
Note that "monteenth", "tuesteenth", etc are all made up words. There was a
|
20
|
+
meetup whose members realized that there are exactly 7 numbered days in a month
|
21
|
+
that end in '-teenth'. Therefore, one is guaranteed that each day of the week
|
18
22
|
(Monday, Tuesday, ...) will have exactly one date that is named with '-teenth'
|
19
23
|
in every month.
|
20
24
|
|
21
|
-
Given examples of a meetup dates, each containing a month, day, year, and
|
22
|
-
|
23
|
-
|
25
|
+
Given examples of a meetup dates, each containing a month, day, year, and
|
26
|
+
descriptor calculate the date of the actual meetup. For example, if given
|
27
|
+
"The first Monday of January 2017", the correct meetup date is 2017/1/2.
|
24
28
|
|
25
29
|
## Running the tests
|
26
30
|
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Given a single stranded DNA string, compute how many times each nucleotide occurs in the string.
|
4
4
|
|
5
|
-
The genetic language of every living thing on the planet is DNA.
|
6
|
-
DNA is a large molecule that is built from an extremely long sequence of individual elements called nucleotides.
|
5
|
+
The genetic language of every living thing on the planet is DNA.
|
6
|
+
DNA is a large molecule that is built from an extremely long sequence of individual elements called nucleotides.
|
7
7
|
4 types exist in DNA and these differ only slightly and can be represented as the following symbols: 'A' for adenine, 'C' for cytosine, 'G' for guanine, and 'T' thymine.
|
8
8
|
|
9
9
|
Here is an analogy:
|
@@ -14,7 +14,7 @@ The format is usually represented as
|
|
14
14
|
|
15
15
|
where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9.
|
16
16
|
|
17
|
-
Your task is to clean up differently
|
17
|
+
Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present.
|
18
18
|
|
19
19
|
For example, the inputs
|
20
20
|
- `+1 (613)-995-0253`
|
@@ -1,30 +1,30 @@
|
|
1
|
-
#
|
1
|
+
# Queen Attack
|
2
2
|
|
3
|
-
|
3
|
+
Given the position of two queens on a chess board, indicate whether or not they
|
4
|
+
are positioned so that they can attack each other.
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
The conjecture states that no matter which number you start with, you will
|
8
|
-
always reach 1 eventually.
|
6
|
+
In the game of chess, a queen can attack pieces which are on the same
|
7
|
+
row, column, or diagonal.
|
9
8
|
|
10
|
-
|
9
|
+
A chessboard can be represented by an 8 by 8 array.
|
11
10
|
|
12
|
-
|
11
|
+
So if you're told the white queen is at (2, 3) and the black queen at
|
12
|
+
(5, 6), then you'd know you've got a set-up like so:
|
13
13
|
|
14
|
-
|
14
|
+
```text
|
15
|
+
_ _ _ _ _ _ _ _
|
16
|
+
_ _ _ _ _ _ _ _
|
17
|
+
_ _ _ W _ _ _ _
|
18
|
+
_ _ _ _ _ _ _ _
|
19
|
+
_ _ _ _ _ _ _ _
|
20
|
+
_ _ _ _ _ _ B _
|
21
|
+
_ _ _ _ _ _ _ _
|
22
|
+
_ _ _ _ _ _ _ _
|
23
|
+
```
|
15
24
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
3. 10
|
20
|
-
4. 5
|
21
|
-
5. 16
|
22
|
-
6. 8
|
23
|
-
7. 4
|
24
|
-
8. 2
|
25
|
-
9. 1
|
26
|
-
|
27
|
-
Resulting in 9 steps. So for input n = 12, the return value would be 9.
|
25
|
+
You'd also be able to answer whether the queens can attack each other.
|
26
|
+
In this case, that answer would be yes, they can, because both pieces
|
27
|
+
share a diagonal.
|
28
28
|
|
29
29
|
## Running the tests
|
30
30
|
|
@@ -37,7 +37,7 @@ you're having trouble, please visit the exercism.io [Lua language page](http://e
|
|
37
37
|
|
38
38
|
## Source
|
39
39
|
|
40
|
-
|
40
|
+
J Dalbey's Programming Practice problems [http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html](http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html)
|
41
41
|
|
42
42
|
## Submitting Incomplete Solutions
|
43
43
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -37,27 +37,27 @@ The above diagram contains 6 rectangles:
|
|
37
37
|
```
|
38
38
|
|
39
39
|
```text
|
40
|
-
|
41
|
-
|
40
|
+
|
41
|
+
|
42
42
|
+--+
|
43
43
|
| |
|
44
44
|
+--+
|
45
45
|
```
|
46
46
|
|
47
47
|
```text
|
48
|
-
|
49
|
-
|
48
|
+
|
49
|
+
|
50
50
|
+--+
|
51
51
|
| |
|
52
52
|
+--+
|
53
53
|
```
|
54
54
|
|
55
55
|
```text
|
56
|
-
|
57
|
-
++
|
58
|
-
++
|
59
|
-
|
60
|
-
|
56
|
+
|
57
|
+
++
|
58
|
+
++
|
59
|
+
|
60
|
+
|
61
61
|
```
|
62
62
|
|
63
63
|
You may assume that the input is always a proper rectangle (i.e. the length of
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# reverse-string
|
2
|
+
|
3
|
+
Reverse a string
|
4
|
+
|
5
|
+
For example:
|
6
|
+
input: "cool"
|
7
|
+
output: "looc"
|
8
|
+
|
9
|
+
## Running the tests
|
10
|
+
|
11
|
+
To run the tests, run the command `busted .` from within the exercise directory.
|
12
|
+
|
13
|
+
## Further information
|
14
|
+
|
15
|
+
For more detailed information about the Lua track, including how to get help if
|
16
|
+
you're having trouble, please visit the exercism.io [Lua language page](http://exercism.io/languages/lua/about).
|
17
|
+
|
18
|
+
## Source
|
19
|
+
|
20
|
+
Introductory challenge to reverse an input string [https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb](https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb)
|
21
|
+
|
22
|
+
## Submitting Incomplete Solutions
|
23
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
local reverse_string = require('reverse-string')
|
2
|
+
|
3
|
+
describe('reverse-string', function()
|
4
|
+
it('an empty string', function()
|
5
|
+
assert.are.equal('', reverse_string(''))
|
6
|
+
end)
|
7
|
+
|
8
|
+
it('a word', function()
|
9
|
+
assert.are.equal('tobor', reverse_string('robot'))
|
10
|
+
end)
|
11
|
+
|
12
|
+
it('a capitalized word', function()
|
13
|
+
assert.are.equal('nemaR', reverse_string('Ramen'))
|
14
|
+
end)
|
15
|
+
|
16
|
+
it('a sentence with punctuation', function()
|
17
|
+
assert.are.equal("!yrgnuh m'I", reverse_string("I'm hungry!"))
|
18
|
+
|
19
|
+
end)
|
20
|
+
|
21
|
+
it('a palindrome', function()
|
22
|
+
assert.are.equal('racecar', reverse_string('racecar'))
|
23
|
+
end)
|
24
|
+
end)
|
@@ -39,7 +39,7 @@ you're having trouble, please visit the exercism.io [Lua language page](http://e
|
|
39
39
|
|
40
40
|
## Source
|
41
41
|
|
42
|
-
Bert, in Mary Poppins [http://www.imdb.com/
|
42
|
+
Bert, in Mary Poppins [http://www.imdb.com/title/tt0058331/quotes/qt0437047](http://www.imdb.com/title/tt0058331/quotes/qt0437047)
|
43
43
|
|
44
44
|
## Submitting Incomplete Solutions
|
45
45
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -12,8 +12,7 @@ Given an age in seconds, calculate how old someone would be on:
|
|
12
12
|
- Neptune: orbital period 164.79132 Earth years
|
13
13
|
|
14
14
|
So if you were told someone were 1,000,000,000 seconds old, you should
|
15
|
-
be able to say that they're 31.69 Earth-years old.
|
16
|
-
the nearest hundredth of a year.
|
15
|
+
be able to say that they're 31.69 Earth-years old.
|
17
16
|
|
18
17
|
If you're wondering why Pluto didn't make the cut, go watch [this
|
19
18
|
youtube video](http://www.youtube.com/watch?v=Z_2gbGXzFbs).
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# Sum Of Multiples
|
2
2
|
|
3
|
-
Given a number, find the sum of all the multiples of particular numbers up to
|
3
|
+
Given a number, find the sum of all the unique multiples of particular numbers up to
|
4
4
|
but not including that number.
|
5
5
|
|
6
|
-
If we list all the natural numbers
|
7
|
-
|
6
|
+
If we list all the natural numbers below 20 that are multiples of 3 or 5,
|
7
|
+
we get 3, 5, 6, 9, 10, 12, 15, and 18.
|
8
8
|
|
9
9
|
The sum of these multiples is 78.
|
10
10
|
|