trackler 2.2.1.71 → 2.2.1.72
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/book-store/canonical-data.json +9 -2
- data/problem-specifications/exercises/word-count/canonical-data.json +9 -0
- data/tracks/bash/CONTRIBUTING.md +199 -0
- data/tracks/bash/config.json +24 -11
- data/tracks/bash/exercises/triangle/README.md +38 -0
- data/tracks/bash/exercises/triangle/example.sh +56 -0
- data/tracks/bash/exercises/triangle/triangle_test.sh +126 -0
- data/tracks/bash/img/canonical-data-example.png +0 -0
- data/tracks/bash/img/create-pr.png +0 -0
- data/tracks/bash/img/fork-repository.png +0 -0
- data/tracks/c/exercises/acronym/makefile +1 -1
- data/tracks/c/exercises/all-your-base/makefile +1 -1
- data/tracks/c/exercises/allergies/makefile +1 -1
- data/tracks/c/exercises/anagram/makefile +1 -1
- data/tracks/c/exercises/atbash-cipher/makefile +1 -1
- data/tracks/c/exercises/beer-song/makefile +1 -1
- data/tracks/c/exercises/binary-search/makefile +1 -1
- data/tracks/c/exercises/binary/makefile +1 -1
- data/tracks/c/exercises/bob/makefile +1 -1
- data/tracks/c/exercises/clock/makefile +1 -1
- data/tracks/c/exercises/collatz-conjecture/makefile +1 -1
- data/tracks/c/exercises/difference-of-squares/makefile +1 -1
- data/tracks/c/exercises/gigasecond/makefile +1 -1
- data/tracks/c/exercises/grains/makefile +1 -1
- data/tracks/c/exercises/hamming/makefile +1 -1
- data/tracks/c/exercises/hamming/test/test_hamming.c +2 -2
- data/tracks/c/exercises/hello-world/makefile +1 -1
- data/tracks/c/exercises/isogram/makefile +1 -1
- data/tracks/c/exercises/largest-series-product/makefile +1 -1
- data/tracks/c/exercises/leap/makefile +1 -1
- data/tracks/c/exercises/meetup/makefile +1 -1
- data/tracks/c/exercises/nth-prime/makefile +1 -1
- data/tracks/c/exercises/nucleotide-count/makefile +1 -1
- data/tracks/c/exercises/palindrome-products/makefile +1 -1
- data/tracks/c/exercises/pangram/makefile +1 -1
- data/tracks/c/exercises/pascals-triangle/makefile +1 -1
- data/tracks/c/exercises/perfect-numbers/makefile +1 -1
- data/tracks/c/exercises/phone-number/makefile +1 -1
- data/tracks/c/exercises/queen-attack/makefile +1 -1
- data/tracks/c/exercises/raindrops/makefile +1 -1
- data/tracks/c/exercises/react/makefile +1 -1
- data/tracks/c/exercises/rna-transcription/makefile +1 -1
- data/tracks/c/exercises/robot-simulator/makefile +1 -1
- data/tracks/c/exercises/roman-numerals/makefile +1 -1
- data/tracks/c/exercises/scrabble-score/makefile +1 -1
- data/tracks/c/exercises/series/makefile +1 -1
- data/tracks/c/exercises/sieve/makefile +1 -1
- data/tracks/c/exercises/space-age/makefile +1 -1
- data/tracks/c/exercises/sublist/makefile +1 -1
- data/tracks/c/exercises/sum-of-multiples/makefile +1 -1
- data/tracks/c/exercises/triangle/makefile +1 -1
- data/tracks/c/exercises/word-count/makefile +1 -1
- data/tracks/delphi/exercises/allergies/README.md +1 -1
- data/tracks/delphi/exercises/bank-account/README.md +1 -1
- data/tracks/delphi/exercises/beer-song/README.md +1 -1
- data/tracks/delphi/exercises/binary-search/README.md +1 -1
- data/tracks/delphi/exercises/bob/README.md +1 -1
- data/tracks/delphi/exercises/book-store/README.md +1 -1
- data/tracks/delphi/exercises/book-store/uBookStoreExample.pas +34 -14
- data/tracks/delphi/exercises/book-store/uBookStoreTests.pas +36 -1
- data/tracks/delphi/exercises/bowling/README.md +1 -1
- data/tracks/delphi/exercises/circular-buffer/README.md +1 -1
- data/tracks/delphi/exercises/clock/README.md +1 -1
- data/tracks/delphi/exercises/collatz-conjecture/README.md +1 -1
- data/tracks/delphi/exercises/etl/README.md +1 -1
- data/tracks/delphi/exercises/grains/README.md +1 -1
- data/tracks/delphi/exercises/hamming/README.md +1 -1
- data/tracks/delphi/exercises/hello-world/README.md +1 -1
- data/tracks/delphi/exercises/leap/README.md +1 -1
- data/tracks/delphi/exercises/minesweeper/README.md +1 -1
- data/tracks/delphi/exercises/nucleotide-count/README.md +1 -1
- data/tracks/delphi/exercises/perfect-numbers/README.md +1 -1
- data/tracks/delphi/exercises/phone-number/README.md +1 -1
- data/tracks/delphi/exercises/pig-latin/README.md +1 -1
- data/tracks/delphi/exercises/poker/README.md +1 -1
- data/tracks/delphi/exercises/raindrops/README.md +1 -1
- data/tracks/delphi/exercises/reverse-string/README.md +1 -1
- data/tracks/delphi/exercises/rna-transcription/README.md +1 -1
- data/tracks/delphi/exercises/roman-numerals/README.md +1 -1
- data/tracks/delphi/exercises/saddle-points/README.md +1 -1
- data/tracks/delphi/exercises/triangle/README.md +1 -1
- data/tracks/delphi/exercises/two-fer/README.md +1 -1
- data/tracks/delphi/exercises/wordy/README.md +1 -1
- data/tracks/ecmascript/.travis.yml +1 -1
- data/tracks/ecmascript/Makefile +4 -5
- data/tracks/ecmascript/README.md +2 -1
- data/tracks/ecmascript/config.json +12 -0
- data/tracks/ecmascript/exercises/change/package.json +5 -3
- data/tracks/ecmascript/exercises/protein-translation/package.json +2 -2
- data/tracks/ecmascript/exercises/react/README.md +41 -0
- data/tracks/ecmascript/exercises/react/example.js +101 -0
- data/tracks/ecmascript/exercises/react/package.json +71 -0
- data/tracks/ecmascript/exercises/react/react.spec.js +211 -0
- data/tracks/ecmascript/exercises/rectangles/package.json +1 -2
- data/tracks/ecmascript/exercises/rotational-cipher/package.json +1 -2
- data/tracks/ecmascript/exercises/spiral-matrix/package.json +1 -2
- data/tracks/ecmascript/exercises/transpose/package.json +2 -2
- data/tracks/erlang/docs/ABOUT.md +1 -1
- data/tracks/go/exercises/binary-search/.meta/gen.go +55 -0
- data/tracks/go/exercises/binary-search/binary_search_test.go +26 -167
- data/tracks/go/exercises/binary-search/cases_test.go +73 -0
- data/tracks/go/exercises/binary-search/example.go +8 -30
- data/tracks/go/exercises/nth-prime/.meta/gen.go +76 -0
- data/tracks/go/exercises/nth-prime/cases_test.go +43 -0
- data/tracks/go/exercises/nth-prime/nth_prime_test.go +4 -18
- data/tracks/go/exercises/prime-factors/.meta/gen.go +54 -0
- data/tracks/go/exercises/prime-factors/cases_test.go +48 -0
- data/tracks/go/exercises/prime-factors/prime_factors_test.go +4 -19
- data/tracks/groovy/config.json +13 -1
- data/tracks/groovy/exercises/linked-list/DoubleLinkedList.groovy +19 -0
- data/tracks/groovy/exercises/linked-list/DoubleLinkedListSpec.groovy +79 -0
- data/tracks/groovy/exercises/linked-list/Example.groovy +57 -0
- data/tracks/groovy/exercises/linked-list/README.md +49 -0
- data/tracks/java/bin/run-journey-test-from-ci.sh +1 -1
- data/tracks/java/config.json +10 -0
- data/tracks/java/config/maintainers.json +8 -1
- data/tracks/java/docs/MAINTAINING.md +3 -3
- data/tracks/java/exercises/accumulate/.meta/src/reference/java/Accumulate.java +2 -2
- data/tracks/java/exercises/binary/.meta/src/reference/java/Binary.java +3 -3
- data/tracks/java/exercises/circular-buffer/.meta/src/reference/java/BufferIOException.java +1 -1
- data/tracks/java/exercises/circular-buffer/.meta/src/reference/java/CircularBuffer.java +6 -6
- data/tracks/java/exercises/circular-buffer/src/main/java/BufferIOException.java +1 -1
- data/tracks/java/exercises/clock/.meta/src/reference/java/Clock.java +3 -3
- data/tracks/java/exercises/crypto-square/.meta/src/reference/java/Crypto.java +7 -7
- data/tracks/java/exercises/etl/.meta/src/reference/java/Etl.java +2 -2
- data/tracks/java/exercises/etl/src/main/java/Etl.java +2 -2
- data/tracks/java/exercises/kindergarten-garden/.meta/src/reference/java/KindergartenGarden.java +4 -4
- data/tracks/java/exercises/kindergarten-garden/.meta/src/reference/java/Plant.java +2 -2
- data/tracks/java/exercises/kindergarten-garden/src/main/java/Plant.java +2 -2
- data/tracks/java/exercises/nth-prime/.meta/src/reference/java/PrimeCalculator.java +2 -2
- data/tracks/java/exercises/reverse-string/.meta/src/reference/java/ReverseString.java +7 -0
- data/tracks/java/exercises/reverse-string/.meta/version +1 -0
- data/tracks/java/exercises/reverse-string/README.md +25 -0
- data/tracks/java/exercises/reverse-string/build.gradle +17 -0
- data/tracks/java/exercises/reverse-string/src/main/java/ReverseString.java +7 -0
- data/tracks/java/exercises/reverse-string/src/test/java/ReverseStringTest.java +37 -0
- data/tracks/java/exercises/run-length-encoding/.meta/src/reference/java/RunLengthEncoding.java +4 -4
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/kotlin/docs/RESOURCES.md +1 -1
- data/tracks/kotlin/exercises/accumulate/build.gradle +1 -1
- data/tracks/kotlin/exercises/acronym/build.gradle +1 -1
- data/tracks/kotlin/exercises/all-your-base/build.gradle +1 -1
- data/tracks/kotlin/exercises/allergies/build.gradle +1 -1
- data/tracks/kotlin/exercises/anagram/build.gradle +1 -1
- data/tracks/kotlin/exercises/atbash-cipher/build.gradle +1 -1
- data/tracks/kotlin/exercises/bank-account/build.gradle +1 -1
- data/tracks/kotlin/exercises/beer-song/build.gradle +1 -1
- data/tracks/kotlin/exercises/binary-search/build.gradle +1 -1
- data/tracks/kotlin/exercises/binary/build.gradle +1 -1
- data/tracks/kotlin/exercises/bob/build.gradle +1 -1
- data/tracks/kotlin/exercises/bracket-push/build.gradle +1 -1
- data/tracks/kotlin/exercises/change/build.gradle +1 -1
- data/tracks/kotlin/exercises/clock/build.gradle +1 -1
- data/tracks/kotlin/exercises/collatz-conjecture/build.gradle +1 -1
- data/tracks/kotlin/exercises/complex-numbers/build.gradle +1 -1
- data/tracks/kotlin/exercises/diamond/build.gradle +1 -1
- data/tracks/kotlin/exercises/difference-of-squares/build.gradle +1 -1
- data/tracks/kotlin/exercises/etl/build.gradle +1 -1
- data/tracks/kotlin/exercises/flatten-array/build.gradle +1 -1
- data/tracks/kotlin/exercises/forth/build.gradle +1 -1
- data/tracks/kotlin/exercises/gigasecond/build.gradle +1 -1
- data/tracks/kotlin/exercises/grade-school/build.gradle +1 -1
- data/tracks/kotlin/exercises/grains/build.gradle +1 -1
- data/tracks/kotlin/exercises/hamming/build.gradle +1 -1
- data/tracks/kotlin/exercises/hello-world/build.gradle +1 -1
- data/tracks/kotlin/exercises/hexadecimal/build.gradle +1 -1
- data/tracks/kotlin/exercises/isogram/build.gradle +1 -1
- data/tracks/kotlin/exercises/largest-series-product/build.gradle +1 -1
- data/tracks/kotlin/exercises/leap/build.gradle +1 -1
- data/tracks/kotlin/exercises/linked-list/build.gradle +1 -1
- data/tracks/kotlin/exercises/list-ops/build.gradle +1 -1
- data/tracks/kotlin/exercises/luhn/build.gradle +1 -1
- data/tracks/kotlin/exercises/meetup/build.gradle +1 -1
- data/tracks/kotlin/exercises/minesweeper/build.gradle +1 -1
- data/tracks/kotlin/exercises/nth-prime/build.gradle +1 -1
- data/tracks/kotlin/exercises/nucleotide-count/build.gradle +1 -1
- data/tracks/kotlin/exercises/pangram/build.gradle +1 -1
- data/tracks/kotlin/exercises/pascals-triangle/build.gradle +1 -1
- data/tracks/kotlin/exercises/perfect-numbers/build.gradle +1 -1
- data/tracks/kotlin/exercises/phone-number/build.gradle +1 -1
- data/tracks/kotlin/exercises/pig-latin/build.gradle +1 -1
- data/tracks/kotlin/exercises/prime-factors/build.gradle +1 -1
- data/tracks/kotlin/exercises/raindrops/build.gradle +1 -1
- data/tracks/kotlin/exercises/react/build.gradle +1 -1
- data/tracks/kotlin/exercises/rna-transcription/build.gradle +1 -1
- data/tracks/kotlin/exercises/robot-name/build.gradle +1 -1
- data/tracks/kotlin/exercises/robot-simulator/build.gradle +1 -1
- data/tracks/kotlin/exercises/roman-numerals/build.gradle +1 -1
- data/tracks/kotlin/exercises/rotational-cipher/build.gradle +1 -1
- data/tracks/kotlin/exercises/saddle-points/build.gradle +1 -1
- data/tracks/kotlin/exercises/say/build.gradle +1 -1
- data/tracks/kotlin/exercises/scrabble-score/build.gradle +1 -1
- data/tracks/kotlin/exercises/secret-handshake/build.gradle +1 -1
- data/tracks/kotlin/exercises/series/build.gradle +1 -1
- data/tracks/kotlin/exercises/sieve/build.gradle +1 -1
- data/tracks/kotlin/exercises/simple-cipher/README.md +4 -6
- data/tracks/kotlin/exercises/simple-cipher/build.gradle +1 -1
- data/tracks/kotlin/exercises/space-age/build.gradle +1 -1
- data/tracks/kotlin/exercises/spiral-matrix/build.gradle +1 -1
- data/tracks/kotlin/exercises/strain/build.gradle +1 -1
- data/tracks/kotlin/exercises/sublist/build.gradle +1 -1
- data/tracks/kotlin/exercises/sum-of-multiples/build.gradle +1 -1
- data/tracks/kotlin/exercises/triangle/build.gradle +1 -1
- data/tracks/kotlin/exercises/two-fer/build.gradle +1 -1
- data/tracks/kotlin/exercises/word-count/build.gradle +1 -1
- data/tracks/lua/.gitignore +1 -0
- data/tracks/lua/config.json +12 -0
- data/tracks/lua/exercises/isbn-verifier/README.md +52 -0
- data/tracks/lua/exercises/isbn-verifier/example.lua +16 -0
- data/tracks/lua/exercises/isbn-verifier/isbn-verifier_spec.lua +55 -0
- data/tracks/ocaml/.travis-ci.sh +1 -1
- data/tracks/ocaml/.travis.yml +1 -1
- data/tracks/ocaml/README.md +1 -1
- data/tracks/perl6/config.json +10 -0
- data/tracks/perl6/exercises/acronym/Acronym.pm6 +4 -0
- data/tracks/perl6/exercises/acronym/Example.pm6 +5 -0
- data/tracks/perl6/exercises/acronym/README.md +33 -0
- data/tracks/perl6/exercises/acronym/acronym.t +96 -0
- data/tracks/perl6/exercises/acronym/example.yaml +19 -0
- data/tracks/perl6/exercises/word-count/Example.pm6 +1 -1
- data/tracks/perl6/exercises/word-count/WordCount.pm6 +1 -1
- data/tracks/perl6/exercises/word-count/example.yaml +2 -2
- data/tracks/perl6/exercises/word-count/word-count.t +11 -2
- data/tracks/pony/docs/RESOURCES.md +1 -1
- data/tracks/purescript/docs/INSTALLATION.md +1 -3
- data/tracks/python/config.json +1 -1
- data/tracks/r/exercises/word-count/test_word-count.R +5 -0
- data/tracks/ruby/README.md +73 -10
- data/tracks/rust/config.json +34 -0
- data/tracks/rust/exercises/book-store/Cargo.toml +1 -1
- data/tracks/rust/exercises/book-store/tests/book-store.rs +7 -0
- data/tracks/rust/exercises/diffie-hellman/.gitignore +9 -0
- data/tracks/rust/exercises/diffie-hellman/Cargo-example.toml +6 -0
- data/tracks/rust/exercises/diffie-hellman/Cargo.toml +5 -0
- data/tracks/rust/exercises/diffie-hellman/README.md +77 -0
- data/tracks/rust/exercises/diffie-hellman/example.rs +15 -0
- data/tracks/rust/exercises/diffie-hellman/src/lib.rs +11 -0
- data/tracks/rust/exercises/diffie-hellman/tests/diffie-hellman.rs +60 -0
- data/tracks/rust/exercises/macros/.gitignore +3 -0
- data/tracks/rust/exercises/macros/.meta/description.md +29 -0
- data/tracks/rust/exercises/macros/.meta/metadata.yml +3 -0
- data/tracks/rust/exercises/macros/Cargo.toml +6 -0
- data/tracks/rust/exercises/macros/README.md +70 -0
- data/tracks/rust/exercises/macros/example.rs +16 -0
- data/tracks/rust/exercises/macros/src/lib.rs +6 -0
- data/tracks/rust/exercises/macros/tests/macros.rs +62 -0
- data/tracks/rust/exercises/simple-linked-list/.gitignore +7 -0
- data/tracks/rust/exercises/simple-linked-list/.meta/hints.md +34 -0
- data/tracks/rust/exercises/simple-linked-list/Cargo.toml +5 -0
- data/tracks/rust/exercises/simple-linked-list/README.md +96 -0
- data/tracks/rust/exercises/simple-linked-list/example.rs +87 -0
- data/tracks/rust/exercises/simple-linked-list/src/lib.rs +46 -0
- data/tracks/rust/exercises/simple-linked-list/tests/simple-linked-list.rs +91 -0
- data/tracks/swift/.travis.yml +1 -1
- data/tracks/swift/config.json +24 -0
- data/tracks/swift/exercises/isbn-verifier/Package.swift +5 -0
- data/tracks/swift/exercises/isbn-verifier/README.md +39 -0
- data/tracks/swift/exercises/isbn-verifier/Sources/IsbnVerifier.swift +1 -0
- data/tracks/swift/exercises/isbn-verifier/Sources/IsbnVerifierExample.swift +35 -0
- data/tracks/swift/exercises/isbn-verifier/Tests/IsbnVerifierTests/IsbnVerifierTests.swift +75 -0
- data/tracks/swift/exercises/isbn-verifier/Tests/LinuxMain.swift +6 -0
- data/tracks/swift/exercises/two-fer/Package.swift +5 -0
- data/tracks/swift/exercises/two-fer/README.md +54 -0
- data/tracks/swift/exercises/two-fer/Sources/TwoFer.swift +1 -0
- data/tracks/swift/exercises/two-fer/Sources/TwoFerExample.swift +6 -0
- data/tracks/swift/exercises/two-fer/Tests/LinuxMain.swift +6 -0
- data/tracks/swift/exercises/two-fer/Tests/TwoFerTests/TwoFerTests.swift +25 -0
- metadata +71 -2
@@ -0,0 +1,49 @@
|
|
1
|
+
# Linked List
|
2
|
+
|
3
|
+
Implement a doubly linked list.
|
4
|
+
|
5
|
+
Like an array, a linked list is a simple linear data structure. Several
|
6
|
+
common data types can be implemented using linked lists, like queues,
|
7
|
+
stacks, and associative arrays.
|
8
|
+
|
9
|
+
A linked list is a collection of data elements called *nodes*. In a
|
10
|
+
*singly linked list* each node holds a value and a link to the next node.
|
11
|
+
In a *doubly linked list* each node also holds a link to the previous
|
12
|
+
node.
|
13
|
+
|
14
|
+
You will write an implementation of a doubly linked list. Implement a
|
15
|
+
Node to hold a value and pointers to the next and previous nodes. Then
|
16
|
+
implement a List which holds references to the first and last node and
|
17
|
+
offers an array-like interface for adding and removing items:
|
18
|
+
|
19
|
+
* `push` (*insert value at back*);
|
20
|
+
* `pop` (*remove value at back*);
|
21
|
+
* `shift` (*remove value at front*).
|
22
|
+
* `unshift` (*insert value at front*);
|
23
|
+
|
24
|
+
To keep your implementation simple, the tests will not cover error
|
25
|
+
conditions. Specifically: `pop` or `shift` will never be called on an
|
26
|
+
empty list.
|
27
|
+
|
28
|
+
If you want to know more about linked lists, check [Wikipedia](https://en.wikipedia.org/wiki/Linked_list).
|
29
|
+
|
30
|
+
For installation and learning resources, refer to the
|
31
|
+
[exercism help page](http://exercism.io/languages/groovy).
|
32
|
+
|
33
|
+
# Running the tests
|
34
|
+
|
35
|
+
You can run all the tests for an exercise by entering
|
36
|
+
|
37
|
+
```
|
38
|
+
$ groovy ./LinkedListSpec.groovy
|
39
|
+
```
|
40
|
+
|
41
|
+
in your terminal.
|
42
|
+
|
43
|
+
## Source
|
44
|
+
|
45
|
+
Classic computer science topic
|
46
|
+
|
47
|
+
## Submitting Incomplete Solutions
|
48
|
+
|
49
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -17,7 +17,7 @@ for file in $modded_files
|
|
17
17
|
do if [[ $file == exercises* ]] || [[ $file == config.json ]]
|
18
18
|
then
|
19
19
|
for file2 in $modded_files
|
20
|
-
do if [[ $file2 == exercises* ]]
|
20
|
+
do if [[ $file2 == exercises* ]] && [[ $file2 != exercises/settings.gradle ]]
|
21
21
|
then modded_exercise=${file2#exercises/}
|
22
22
|
modded_exercise=${modded_exercise%%/*}
|
23
23
|
if [[ $last_modded_exercise != $modded_exercise ]]
|
data/tracks/java/config.json
CHANGED
@@ -23,6 +23,16 @@
|
|
23
23
|
"unlocked_by": null,
|
24
24
|
"uuid": "74515d45-565b-4be2-96c4-77e58efa9257"
|
25
25
|
},
|
26
|
+
{
|
27
|
+
"core": false,
|
28
|
+
"difficulty": 1,
|
29
|
+
"slug": "reverse-string",
|
30
|
+
"topics": [
|
31
|
+
"strings"
|
32
|
+
],
|
33
|
+
"unlocked_by": "two-fer",
|
34
|
+
"uuid": "2c8afeed-480e-41f3-ad58-590fa8f88029"
|
35
|
+
},
|
26
36
|
{
|
27
37
|
"core": false,
|
28
38
|
"difficulty": 2,
|
@@ -53,6 +53,13 @@
|
|
53
53
|
"github_username": "FridaTveit",
|
54
54
|
"name": "Frida Johanne Tveit",
|
55
55
|
"show_on_website": true
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"alumnus": false,
|
59
|
+
"bio": "I am a software developer and consultant working for Black Pepper Software, a software company based in Leamington Spa, England. I'm a recent Computer Science graduate from the University of Warwick, and love all things to do with computers!",
|
60
|
+
"github_username": "sjwarner-bp",
|
61
|
+
"name": "Sam Warner",
|
62
|
+
"show_on_website": true
|
56
63
|
}
|
57
64
|
]
|
58
|
-
}
|
65
|
+
}
|
@@ -23,9 +23,9 @@ As a maintainer, you have write access to several repositories. "write access"
|
|
23
23
|
|
24
24
|
## Maintainer Guides
|
25
25
|
|
26
|
-
- **[
|
27
|
-
- [
|
28
|
-
- [
|
26
|
+
- **[docs/maintaining-a-track/README.md](https://github.com/exercism/docs/blob/master/maintaining-a-track/README.md)**
|
27
|
+
- [docs/contributing-to-language-tracks/README.md](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md)
|
28
|
+
- [docs/you-can-help/review-pull-requests.md](https://github.com/exercism/docs/blob/master/you-can-help/review-pull-requests.md)
|
29
29
|
|
30
30
|
## Miscellaneous
|
31
31
|
|
@@ -2,9 +2,9 @@ import java.util.ArrayList;
|
|
2
2
|
import java.util.List;
|
3
3
|
import java.util.function.Function;
|
4
4
|
|
5
|
-
|
5
|
+
class Accumulate {
|
6
6
|
|
7
|
-
|
7
|
+
static <T> List<T> accumulate(List<T> collection, Function<T, T> function) {
|
8
8
|
List<T> newCollection = new ArrayList<>();
|
9
9
|
|
10
10
|
for (T item : collection) {
|
@@ -1,14 +1,14 @@
|
|
1
|
-
|
1
|
+
class Binary {
|
2
2
|
|
3
3
|
private String binary;
|
4
4
|
private int decimal;
|
5
5
|
|
6
|
-
|
6
|
+
Binary(String binary) {
|
7
7
|
this.binary = binary;
|
8
8
|
this.decimal = getDecimalFromBinary(binary);
|
9
9
|
}
|
10
10
|
|
11
|
-
|
11
|
+
int getDecimal() {
|
12
12
|
return decimal;
|
13
13
|
}
|
14
14
|
|
@@ -1,17 +1,17 @@
|
|
1
1
|
import java.util.LinkedList;
|
2
2
|
import java.util.Queue;
|
3
3
|
|
4
|
-
|
4
|
+
class CircularBuffer<T> {
|
5
5
|
|
6
6
|
private Queue<T> buffer;
|
7
7
|
private int capacity;
|
8
8
|
|
9
|
-
|
9
|
+
CircularBuffer(int size) {
|
10
10
|
this.buffer = new LinkedList<>();
|
11
11
|
this.capacity = size;
|
12
12
|
}
|
13
13
|
|
14
|
-
|
14
|
+
T read() throws BufferIOException {
|
15
15
|
if (this.buffer.size() == 0) {
|
16
16
|
throw new BufferIOException("Tried to read from empty buffer");
|
17
17
|
}
|
@@ -19,14 +19,14 @@ public class CircularBuffer<T> {
|
|
19
19
|
return this.buffer.remove();
|
20
20
|
}
|
21
21
|
|
22
|
-
|
22
|
+
void write(T data) throws BufferIOException {
|
23
23
|
if (this.buffer.size() == this.capacity) {
|
24
24
|
throw new BufferIOException("Tried to write to full buffer");
|
25
25
|
}
|
26
26
|
|
27
27
|
this.buffer.add(data);
|
28
28
|
}
|
29
|
-
|
29
|
+
void overwrite(T data) {
|
30
30
|
if (this.buffer.size() == this.capacity) {
|
31
31
|
this.buffer.remove();
|
32
32
|
}
|
@@ -34,7 +34,7 @@ public class CircularBuffer<T> {
|
|
34
34
|
this.buffer.add(data);
|
35
35
|
}
|
36
36
|
|
37
|
-
|
37
|
+
void clear() {
|
38
38
|
this.buffer.clear();
|
39
39
|
}
|
40
40
|
}
|
@@ -1,17 +1,17 @@
|
|
1
|
-
|
1
|
+
class Clock {
|
2
2
|
private static final int MINUTES_IN_AN_HOUR = 60;
|
3
3
|
private static final int HOURS_IN_A_DAY = 24;
|
4
4
|
|
5
5
|
private int hours;
|
6
6
|
private int minutes;
|
7
7
|
|
8
|
-
|
8
|
+
Clock(int hours, int minutes) {
|
9
9
|
this.hours = hours;
|
10
10
|
this.minutes = minutes;
|
11
11
|
sanitiseTime();
|
12
12
|
}
|
13
13
|
|
14
|
-
|
14
|
+
void add(int minutes) {
|
15
15
|
this.minutes += minutes;
|
16
16
|
sanitiseTime();
|
17
17
|
}
|
@@ -1,21 +1,21 @@
|
|
1
1
|
import java.util.ArrayList;
|
2
2
|
import java.util.List;
|
3
3
|
|
4
|
-
|
4
|
+
class Crypto {
|
5
5
|
|
6
6
|
private String normalizedPlaintext;
|
7
7
|
private int squareSize;
|
8
8
|
|
9
|
-
|
9
|
+
Crypto(String text) {
|
10
10
|
this.normalizedPlaintext = normalizeText(text);
|
11
11
|
this.squareSize = calculateSquareSize(normalizedPlaintext);
|
12
12
|
}
|
13
13
|
|
14
|
-
|
14
|
+
String getNormalizedPlaintext() {
|
15
15
|
return normalizedPlaintext;
|
16
16
|
}
|
17
17
|
|
18
|
-
|
18
|
+
int getSquareSize() {
|
19
19
|
return squareSize;
|
20
20
|
}
|
21
21
|
|
@@ -30,7 +30,7 @@ public class Crypto {
|
|
30
30
|
return (int) Math.ceil(Math.sqrt(text.length()));
|
31
31
|
}
|
32
32
|
|
33
|
-
|
33
|
+
List<String> getPlaintextSegments() {
|
34
34
|
return getSegmentText(normalizedPlaintext, squareSize);
|
35
35
|
}
|
36
36
|
|
@@ -50,11 +50,11 @@ public class Crypto {
|
|
50
50
|
return segments;
|
51
51
|
}
|
52
52
|
|
53
|
-
|
53
|
+
String getCipherText() {
|
54
54
|
return getNormalizedCipherText().replaceAll("\\s", "");
|
55
55
|
}
|
56
56
|
|
57
|
-
|
57
|
+
String getNormalizedCipherText() {
|
58
58
|
StringBuilder cipherText = new StringBuilder(normalizedPlaintext.length());
|
59
59
|
|
60
60
|
for (int index = 0; index < squareSize; index++) {
|
@@ -2,8 +2,8 @@ import java.util.HashMap;
|
|
2
2
|
import java.util.List;
|
3
3
|
import java.util.Map;
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
class Etl {
|
6
|
+
Map<String, Integer> transform(Map<Integer, List<String>> old) {
|
7
7
|
final Map<String, Integer> result = new HashMap<String, Integer>();
|
8
8
|
for (Map.Entry<Integer, List<String>> e : old.entrySet()) {
|
9
9
|
for (String s : e.getValue()) {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import java.util.List;
|
2
2
|
import java.util.Map;
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
class Etl {
|
5
|
+
Map<String, Integer> transform(Map<Integer, List<String>> old) {
|
6
6
|
throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
|
7
7
|
}
|
8
8
|
}
|
data/tracks/java/exercises/kindergarten-garden/.meta/src/reference/java/KindergartenGarden.java
CHANGED
@@ -3,7 +3,7 @@ import java.util.List;
|
|
3
3
|
import java.util.ArrayList;
|
4
4
|
|
5
5
|
|
6
|
-
|
6
|
+
class KindergartenGarden {
|
7
7
|
private String[] students;
|
8
8
|
private String garden;
|
9
9
|
private static final int PLANTS_PER_STUDENT_PER_ROW = 2;
|
@@ -15,18 +15,18 @@ public class KindergartenGarden {
|
|
15
15
|
"Ileana", "Joseph", "Kincaid", "Larry"
|
16
16
|
};
|
17
17
|
|
18
|
-
|
18
|
+
KindergartenGarden(String garden, String[] students) {
|
19
19
|
this.garden = garden;
|
20
20
|
Arrays.sort(students);
|
21
21
|
this.students = students;
|
22
22
|
newRowLocation = garden.indexOf('\n') + 1;
|
23
23
|
}
|
24
24
|
|
25
|
-
|
25
|
+
KindergartenGarden(String garden) {
|
26
26
|
this(garden, DEFAULT_STUDENTS);
|
27
27
|
}
|
28
28
|
|
29
|
-
|
29
|
+
List<Plant> getPlantsOfStudent(String student) {
|
30
30
|
List<Plant> plants = new ArrayList<Plant>();
|
31
31
|
int studentPlantsIndex = Arrays.binarySearch(students, student) * PLANTS_PER_STUDENT_PER_ROW;
|
32
32
|
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.1
|
@@ -0,0 +1,25 @@
|
|
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
|
+
You can run all the tests for an exercise by entering
|
12
|
+
|
13
|
+
```sh
|
14
|
+
$ gradle test
|
15
|
+
```
|
16
|
+
|
17
|
+
in your terminal.
|
18
|
+
|
19
|
+
## Source
|
20
|
+
|
21
|
+
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)
|
22
|
+
|
23
|
+
## Submitting Incomplete Solutions
|
24
|
+
|
25
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
apply plugin: "java"
|
2
|
+
apply plugin: "eclipse"
|
3
|
+
apply plugin: "idea"
|
4
|
+
|
5
|
+
repositories {
|
6
|
+
mavenCentral()
|
7
|
+
}
|
8
|
+
|
9
|
+
dependencies {
|
10
|
+
testCompile "junit:junit:4.12"
|
11
|
+
}
|
12
|
+
test {
|
13
|
+
testLogging {
|
14
|
+
exceptionFormat = 'full'
|
15
|
+
events = ["passed", "failed", "skipped"]
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import org.junit.Ignore;
|
2
|
+
import org.junit.Test;
|
3
|
+
|
4
|
+
import static org.junit.Assert.assertEquals;
|
5
|
+
|
6
|
+
public class ReverseStringTest {
|
7
|
+
|
8
|
+
@Test
|
9
|
+
public void testAnEmptyString() {
|
10
|
+
assertEquals("", new ReverseString().reverse(""));
|
11
|
+
}
|
12
|
+
|
13
|
+
@Ignore("Remove to run test")
|
14
|
+
@Test
|
15
|
+
public void testAWord() {
|
16
|
+
assertEquals("tobor", new ReverseString().reverse("robot"));
|
17
|
+
}
|
18
|
+
|
19
|
+
@Ignore("Remove to run test")
|
20
|
+
@Test
|
21
|
+
public void testACapitalizedWord() {
|
22
|
+
assertEquals("nemaR", new ReverseString().reverse("Ramen"));
|
23
|
+
}
|
24
|
+
|
25
|
+
@Ignore("Remove to run test")
|
26
|
+
@Test
|
27
|
+
public void testASentenceWithPunctuation() {
|
28
|
+
assertEquals("!yrgnuh m'I", new ReverseString().reverse("I'm hungry!"));
|
29
|
+
}
|
30
|
+
|
31
|
+
@Ignore("Remove to run test")
|
32
|
+
@Test
|
33
|
+
public void testAPalindrome() {
|
34
|
+
assertEquals("racecar", new ReverseString().reverse("racecar"));
|
35
|
+
}
|
36
|
+
|
37
|
+
}
|