trackler 2.2.1.39 → 2.2.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/CONTRIBUTING.md +4 -4
- data/problem-specifications/README.md +5 -1
- data/problem-specifications/exercises/acronym/description.md +0 -1
- data/problem-specifications/exercises/all-your-base/description.md +1 -1
- data/problem-specifications/exercises/allergies/description.md +0 -1
- data/problem-specifications/exercises/alphametics/description.md +2 -2
- data/problem-specifications/exercises/atbash-cipher/description.md +2 -1
- data/problem-specifications/exercises/beer-song/description.md +1 -1
- data/problem-specifications/exercises/binary/description.md +2 -0
- data/problem-specifications/exercises/book-store/description.md +5 -5
- data/problem-specifications/exercises/bowling/description.md +20 -6
- data/problem-specifications/exercises/collatz-conjecture/description.md +1 -1
- data/problem-specifications/exercises/connect/description.md +1 -1
- data/problem-specifications/exercises/crypto-square/description.md +4 -4
- data/problem-specifications/exercises/diamond/description.md +6 -6
- data/problem-specifications/exercises/etl/description.md +2 -0
- data/problem-specifications/exercises/flatten-array/description.md +1 -2
- data/problem-specifications/exercises/food-chain/description.md +1 -1
- data/problem-specifications/exercises/go-counting/description.md +1 -1
- data/problem-specifications/exercises/grade-school/description.md +0 -1
- data/problem-specifications/exercises/grains/description.md +0 -1
- data/problem-specifications/exercises/grep/description.md +12 -12
- data/problem-specifications/exercises/house/description.md +1 -2
- data/problem-specifications/exercises/isogram/description.md +2 -1
- data/problem-specifications/exercises/kindergarten-garden/description.md +3 -3
- data/problem-specifications/exercises/leap/description.md +1 -1
- data/problem-specifications/exercises/linked-list/description.md +10 -10
- data/problem-specifications/exercises/luhn/description.md +7 -7
- data/problem-specifications/exercises/matrix/description.md +6 -4
- data/problem-specifications/exercises/meetup/description.md +1 -2
- data/problem-specifications/exercises/nucleotide-count/description.md +8 -22
- data/problem-specifications/exercises/ocr-numbers/description.md +5 -5
- data/problem-specifications/exercises/octal/description.md +6 -2
- data/problem-specifications/exercises/pangram/description.md +1 -1
- data/problem-specifications/exercises/pascals-triangle/description.md +1 -1
- data/problem-specifications/exercises/perfect-numbers/description.md +2 -2
- data/problem-specifications/exercises/phone-number/description.md +3 -2
- data/problem-specifications/exercises/pov/description.md +2 -2
- data/problem-specifications/exercises/protein-translation/description.md +4 -5
- data/problem-specifications/exercises/proverb/description.md +12 -9
- data/problem-specifications/exercises/pythagorean-triplet/description.md +3 -3
- data/problem-specifications/exercises/queen-attack/description.md +1 -1
- data/problem-specifications/exercises/rail-fence-cipher/description.md +12 -7
- data/problem-specifications/exercises/rectangles/description.md +7 -7
- data/problem-specifications/exercises/roman-numerals/description.md +1 -1
- data/problem-specifications/exercises/rotational-cipher/description.md +2 -1
- data/problem-specifications/exercises/run-length-encoding/description.md +4 -4
- data/problem-specifications/exercises/saddle-points/description.md +1 -1
- data/problem-specifications/exercises/scale-generator/description.md +0 -1
- data/problem-specifications/exercises/scrabble-score/description.md +3 -1
- data/problem-specifications/exercises/secret-handshake/description.md +1 -1
- data/problem-specifications/exercises/sgf-parsing/description.md +3 -3
- data/problem-specifications/exercises/spiral-matrix/description.md +2 -2
- data/problem-specifications/exercises/tournament/description.md +5 -5
- data/problem-specifications/exercises/transpose/description.md +7 -7
- data/problem-specifications/exercises/tree-building/description.md +3 -3
- data/problem-specifications/exercises/triangle/description.md +9 -7
- data/problem-specifications/exercises/trinary/description.md +1 -1
- data/problem-specifications/exercises/twelve-days/description.md +1 -1
- data/problem-specifications/exercises/two-bucket/description.md +3 -3
- data/problem-specifications/exercises/two-fer/description.md +1 -2
- data/problem-specifications/exercises/variable-length-quantity/description.md +6 -7
- data/problem-specifications/exercises/word-count/description.md +1 -2
- data/problem-specifications/exercises/word-search/description.md +1 -1
- data/problem-specifications/exercises/wordy/description.md +0 -5
- data/tracks/bash/config.json +0 -1
- data/tracks/c/exercises/hello-world/src/example.c +2 -5
- data/tracks/c/exercises/hello-world/src/hello_world.c +1 -1
- data/tracks/c/exercises/hello-world/src/hello_world.h +1 -1
- data/tracks/c/exercises/hello-world/test/test_hello_world.c +3 -22
- data/tracks/c/indent.sh +9 -1
- data/tracks/ceylon/exercises/leap/README.md +1 -1
- data/tracks/cpp/README.md +14 -0
- data/tracks/cpp/config.json +219 -219
- data/tracks/cpp/config/maintainers.json +11 -11
- data/tracks/cpp/docs/TESTS.md +6 -16
- data/tracks/cpp/exercises/bracket-push/README.md +42 -0
- data/tracks/cpp/exercises/crypto-square/crypto_square_test.cpp +41 -27
- data/tracks/cpp/exercises/crypto-square/example.cpp +20 -16
- data/tracks/cpp/exercises/gigasecond/gigasecond_test.cpp +1 -1
- data/tracks/cpp/exercises/nucleotide-count/README.md +9 -21
- data/tracks/cpp/exercises/pangram/README.md +47 -0
- data/tracks/cpp/exercises/space-age/README.md +2 -1
- data/tracks/csharp/build.cake +16 -10
- data/tracks/csharp/build.ps1 +128 -60
- data/tracks/csharp/build.sh +53 -27
- data/tracks/csharp/exercises/kindergarten-garden/Example.cs +9 -10
- data/tracks/csharp/exercises/kindergarten-garden/KindergartenGarden.cs +5 -6
- data/tracks/csharp/exercises/kindergarten-garden/KindergartenGardenTest.cs +97 -0
- data/tracks/csharp/exercises/ocr-numbers/Example.cs +60 -7
- data/tracks/csharp/exercises/ocr-numbers/OcrNumbersTest.cs +136 -91
- data/tracks/csharp/exercises/two-bucket/Example.cs +7 -7
- data/tracks/csharp/exercises/two-bucket/TwoBucket.cs +4 -4
- data/tracks/csharp/exercises/two-bucket/TwoBucketTest.cs +45 -47
- data/tracks/csharp/generators/Exercise.cs +6 -1
- data/tracks/csharp/generators/Exercises/KindergartenGarden.cs +30 -0
- data/tracks/csharp/generators/Exercises/OcrNumbers.cs +29 -0
- data/tracks/csharp/generators/Exercises/TwoBucket.cs +49 -0
- data/tracks/csharp/generators/Input/CanonicalDataCase.cs +8 -2
- data/tracks/csharp/generators/Input/CanonicalDataCaseJsonConverter.cs +21 -4
- data/tracks/csharp/generators/Input/CanonicalDataCasesJson.cs +5 -5
- data/tracks/csharp/generators/Output/ValueFormatter.cs +2 -0
- data/tracks/dart/config.json +77 -65
- data/tracks/dart/config/maintainers.json +7 -7
- data/tracks/dart/exercises/anagram/README.md +14 -0
- data/tracks/dart/exercises/anagram/lib/anagram.dart +3 -0
- data/tracks/dart/exercises/anagram/lib/example.dart +52 -0
- data/tracks/dart/exercises/anagram/pubspec.lock +293 -0
- data/tracks/dart/exercises/anagram/pubspec.yaml +3 -0
- data/tracks/dart/exercises/anagram/test/anagram_test.dart +89 -0
- data/tracks/dart/exercises/difference-of-squares/test/difference_of_squares_test.dart +8 -8
- data/tracks/dart/exercises/rna-transcription/test/rna_transcription_test.dart +6 -6
- data/tracks/dart/test/exercises_test.dart +3 -1
- data/tracks/delphi/config.json +38 -27
- data/tracks/delphi/exercises/allergies/README.md +0 -1
- data/tracks/delphi/exercises/beer-song/README.md +1 -1
- data/tracks/delphi/exercises/book-store/README.md +5 -5
- data/tracks/delphi/exercises/bowling/README.md +20 -6
- data/tracks/delphi/exercises/collatz-conjecture/README.md +1 -1
- data/tracks/delphi/exercises/etl/README.md +2 -0
- data/tracks/delphi/exercises/grains/README.md +0 -1
- data/tracks/delphi/exercises/leap/README.md +1 -1
- data/tracks/delphi/exercises/nucleotide-count/README.md +8 -22
- data/tracks/delphi/exercises/perfect-numbers/README.md +2 -2
- data/tracks/delphi/exercises/phone-number/README.md +3 -2
- data/tracks/delphi/exercises/pig-latin/PigLatin.dpr +60 -0
- data/tracks/delphi/exercises/pig-latin/README.md +45 -0
- data/tracks/delphi/exercises/pig-latin/uPigLatinExample.pas +105 -0
- data/tracks/delphi/exercises/pig-latin/uTestPigLatin.pas +196 -0
- 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 +9 -6
- data/tracks/delphi/exercises/two-fer/README.md +1 -2
- data/tracks/delphi/exercises/wordy/README.md +0 -5
- data/tracks/fsharp/build.ps1 +128 -60
- data/tracks/fsharp/build.sh +53 -27
- data/tracks/java/CONTRIBUTING.md +9 -0
- data/tracks/java/config.json +110 -26
- data/tracks/javascript/config.json +15 -0
- data/tracks/javascript/exercises/twelve-days/README.md +61 -0
- data/tracks/javascript/exercises/twelve-days/example.js +51 -0
- data/tracks/javascript/exercises/twelve-days/package.json +69 -0
- data/tracks/javascript/exercises/twelve-days/twelve-days.spec.js +103 -0
- data/tracks/python/docs/SNIPPET.txt +10 -0
- data/tracks/python/exercises/acronym/acronym.py +1 -1
- data/tracks/python/exercises/alphametics/alphametics_test.py +3 -3
- data/tracks/ruby/exercises/simple-cipher/README.md +1 -1
- data/tracks/scala/exercises/change/src/test/scala/ChangeTest.scala +7 -2
- data/tracks/scala/exercises/hamming/src/test/scala/HammingTest.scala +6 -6
- data/tracks/scala/exercises/pangram/src/test/scala/PangramTest.scala +5 -5
- data/tracks/scala/exercises/pig-latin/example.scala +9 -28
- data/tracks/scala/exercises/pig-latin/src/test/scala/PigLatinTest.scala +16 -6
- data/tracks/scala/exercises/queen-attack/example.scala +14 -26
- data/tracks/scala/exercises/queen-attack/src/test/scala/QueenAttackTest.scala +71 -0
- data/tracks/scala/exercises/rna-transcription/src/test/scala/RnaTranscriptionTest.scala +10 -10
- data/tracks/scala/exercises/robot-simulator/src/test/scala/RobotSimulatorTest.scala +127 -0
- data/tracks/scala/exercises/saddle-points/example.scala +11 -7
- data/tracks/scala/exercises/saddle-points/src/test/scala/SaddlePointsTest.scala +21 -14
- data/tracks/scala/exercises/sum-of-multiples/src/test/scala/SumOfMultiplesTest.scala +6 -1
- data/tracks/scala/exercises/word-count/example.scala +7 -8
- data/tracks/scala/exercises/word-count/src/test/scala/WordCountTest.scala +41 -42
- data/tracks/scala/testgen/src/main/resources/version-check-ignore.txt +5 -0
- data/tracks/scala/testgen/src/main/scala/QueenAttackTestGenerator.scala +79 -0
- data/tracks/scala/testgen/src/main/scala/RobotSimulatorTestGenerator.scala +99 -0
- data/tracks/scala/testgen/src/main/scala/SaddlePointsTestGenerator.scala +35 -0
- data/tracks/scala/testgen/src/main/scala/VersionCheck.scala +72 -0
- data/tracks/scala/testgen/src/main/scala/WordCountTestGenerator.scala +39 -0
- data/tracks/swift/exercises/sum-of-multiples/Sources/SumOfMultiplesExample.swift +1 -0
- data/tracks/swift/exercises/sum-of-multiples/Tests/SumOfMultiplesTests/SumOfMultiplesTests.swift +5 -0
- data/tracks/typescript/config.json +66 -0
- data/tracks/typescript/exercises/binary-search-tree/README.md +84 -0
- data/tracks/typescript/exercises/binary-search-tree/binary-search-tree.example.ts +55 -0
- data/tracks/typescript/exercises/binary-search-tree/binary-search-tree.test.ts +85 -0
- data/tracks/typescript/exercises/binary-search-tree/binary-search-tree.ts +0 -0
- data/tracks/typescript/exercises/binary-search-tree/package.json +36 -0
- data/tracks/typescript/exercises/binary-search-tree/tsconfig.json +22 -0
- data/tracks/typescript/exercises/binary-search-tree/tslint.json +127 -0
- data/tracks/typescript/exercises/binary-search-tree/yarn.lock +2305 -0
- data/tracks/typescript/exercises/clock/README.md +33 -0
- data/tracks/typescript/exercises/clock/clock.example.ts +62 -0
- data/tracks/typescript/exercises/clock/clock.test.ts +209 -0
- data/tracks/typescript/exercises/clock/clock.ts +0 -0
- data/tracks/typescript/exercises/clock/package.json +36 -0
- data/tracks/typescript/exercises/clock/tsconfig.json +22 -0
- data/tracks/typescript/exercises/clock/tslint.json +127 -0
- data/tracks/typescript/exercises/clock/yarn.lock +2305 -0
- data/tracks/typescript/exercises/linked-list/README.md +55 -0
- data/tracks/typescript/exercises/linked-list/linked-list.example.ts +128 -0
- data/tracks/typescript/exercises/linked-list/linked-list.test.ts +101 -0
- data/tracks/typescript/exercises/linked-list/linked-list.ts +0 -0
- data/tracks/typescript/exercises/linked-list/package.json +36 -0
- data/tracks/typescript/exercises/linked-list/tsconfig.json +22 -0
- data/tracks/typescript/exercises/linked-list/tslint.json +127 -0
- data/tracks/typescript/exercises/linked-list/yarn.lock +2305 -0
- data/tracks/typescript/exercises/series/README.md +57 -0
- data/tracks/typescript/exercises/series/package.json +36 -0
- data/tracks/typescript/exercises/series/series.example.ts +27 -0
- data/tracks/typescript/exercises/series/series.test.ts +58 -0
- data/tracks/typescript/exercises/series/series.ts +0 -0
- data/tracks/typescript/exercises/series/tsconfig.json +22 -0
- data/tracks/typescript/exercises/series/tslint.json +127 -0
- data/tracks/typescript/exercises/series/yarn.lock +2305 -0
- data/tracks/typescript/exercises/sum-of-multiples/README.md +44 -0
- data/tracks/typescript/exercises/sum-of-multiples/package.json +36 -0
- data/tracks/typescript/exercises/sum-of-multiples/sum-of-multiples.example.ts +21 -0
- data/tracks/typescript/exercises/sum-of-multiples/sum-of-multiples.test.ts +39 -0
- data/tracks/typescript/exercises/sum-of-multiples/sum-of-multiples.ts +0 -0
- data/tracks/typescript/exercises/sum-of-multiples/tsconfig.json +22 -0
- data/tracks/typescript/exercises/sum-of-multiples/tslint.json +127 -0
- data/tracks/typescript/exercises/sum-of-multiples/yarn.lock +2305 -0
- metadata +71 -6
- data/tracks/csharp/exercises/kindergarten-garden/KinderGartenGardenTest.cs +0 -60
- data/tracks/scala/exercises/queen-attack/src/main/scala/Queens.scala +0 -8
- data/tracks/scala/exercises/queen-attack/src/test/scala/QueensTest.scala +0 -51
- data/tracks/scala/exercises/robot-simulator/src/test/scala/RobotTest.scala +0 -61
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f995ce4fe305766cbda5eabfcdfe5bfa4f7ebae2
|
|
4
|
+
data.tar.gz: ad03d5401c9a44c5408605405381817715d40c3c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb20fd7f8fc0e98bfe1030abb8c828485695ce43ebb9508183c3fc96d289bc5e8cd332dacf8fbab81698f98b647788497e83c2d81d45d21f6874ad23e7488e12
|
|
7
|
+
data.tar.gz: 1f2a1bda85e248d8e3fa93446ef13c9fb6a30585af1c028a74cff23f3f4d0199306ba6dcf5cbfcc7f2378df2d7cde1e22305e6c3efaa2c652cd9e5372e691e59
|
data/lib/trackler/version.rb
CHANGED
|
@@ -95,7 +95,7 @@ the Exercism ecosystem.
|
|
|
95
95
|
Each language-specific repository can be found under the Exercism GitHub
|
|
96
96
|
organization named with the track ID.
|
|
97
97
|
|
|
98
|
-
```
|
|
98
|
+
```text
|
|
99
99
|
https://github.com/exercism/{TRACK_ID}
|
|
100
100
|
```
|
|
101
101
|
|
|
@@ -241,7 +241,7 @@ A problem must have a unique slug. This slug is used as
|
|
|
241
241
|
|
|
242
242
|
Each track should have the following structure:
|
|
243
243
|
|
|
244
|
-
```
|
|
244
|
+
```text
|
|
245
245
|
├── .gitignore
|
|
246
246
|
├── .travis.yml
|
|
247
247
|
├── LICENSE
|
|
@@ -295,7 +295,7 @@ For a track that is set as `"active": false` in the `config.json`, `exercism fet
|
|
|
295
295
|
will not automatically pull down problems. You can still test the language by
|
|
296
296
|
fetching problems directly, e.g.:
|
|
297
297
|
|
|
298
|
-
```
|
|
298
|
+
```shell
|
|
299
299
|
exercism fetch cpp bob
|
|
300
300
|
```
|
|
301
301
|
|
|
@@ -347,7 +347,7 @@ Please review the details in [README.md](https://github.com/exercism/problem-spe
|
|
|
347
347
|
|
|
348
348
|
### Anatomy of an Exercise
|
|
349
349
|
|
|
350
|
-
See the [anatomy of an exercise](https://github.com/exercism/docs/tree/master/
|
|
350
|
+
See the [anatomy of an exercise](https://github.com/exercism/docs/tree/master/language-tracks/exercises/anatomy) in the docs repository.
|
|
351
351
|
|
|
352
352
|
### Track configuration file
|
|
353
353
|
|
|
@@ -10,7 +10,7 @@ Please see the [contributing guide](https://github.com/exercism/problem-specific
|
|
|
10
10
|
|
|
11
11
|
Each problem's data lives in a directory under `exercises/`
|
|
12
12
|
|
|
13
|
-
```
|
|
13
|
+
```text
|
|
14
14
|
exercises/
|
|
15
15
|
├── accumulate
|
|
16
16
|
│ ├── description.md
|
|
@@ -169,17 +169,21 @@ In order to run these tests, you will need to have `node` and `npm` installed on
|
|
|
169
169
|
Install them from [here](https://nodejs.org/en/). (`npm` comes bundled with most installations of `node`).
|
|
170
170
|
|
|
171
171
|
Install the required packages:
|
|
172
|
+
|
|
172
173
|
```shell
|
|
173
174
|
npm install
|
|
174
175
|
```
|
|
175
176
|
|
|
176
177
|
Run for all exercises:
|
|
178
|
+
|
|
177
179
|
```shell
|
|
178
180
|
npm test
|
|
179
181
|
```
|
|
180
182
|
|
|
181
183
|
Run for single exercise:
|
|
184
|
+
|
|
182
185
|
```shell
|
|
183
186
|
npm run test-one exercises/<exercise>/canonical-data.json
|
|
184
187
|
```
|
|
188
|
+
|
|
185
189
|
Replace `<exercise>` by the name of exercise which you want to check.
|
|
@@ -4,6 +4,7 @@ Implement general base conversion. Given a number in base **a**,
|
|
|
4
4
|
represented as a sequence of digits, convert it to base **b**.
|
|
5
5
|
|
|
6
6
|
## Note
|
|
7
|
+
|
|
7
8
|
- Try to implement the conversion yourself.
|
|
8
9
|
Do not use something else to perform the conversion for you.
|
|
9
10
|
|
|
@@ -26,5 +27,4 @@ The number 1120, *in base 3*, means:
|
|
|
26
27
|
|
|
27
28
|
I think you got the idea!
|
|
28
29
|
|
|
29
|
-
|
|
30
30
|
*Yes. Those three numbers above are exactly the same. Congratulations!*
|
|
@@ -26,4 +26,3 @@ Note: a given score may include allergens **not** listed above (i.e.
|
|
|
26
26
|
allergens that score 256, 512, 1024, etc.). Your program should
|
|
27
27
|
ignore those components of the score. For example, if the allergy
|
|
28
28
|
score is 257, your program should only report the eggs (1) allergy.
|
|
29
|
-
|
|
@@ -5,7 +5,7 @@ letters in words are replaced with numbers.
|
|
|
5
5
|
|
|
6
6
|
For example `SEND + MORE = MONEY`:
|
|
7
7
|
|
|
8
|
-
```
|
|
8
|
+
```text
|
|
9
9
|
S E N D
|
|
10
10
|
M O R E +
|
|
11
11
|
-----------
|
|
@@ -14,7 +14,7 @@ M O N E Y
|
|
|
14
14
|
|
|
15
15
|
Replacing these with valid numbers gives:
|
|
16
16
|
|
|
17
|
-
```
|
|
17
|
+
```text
|
|
18
18
|
9 5 6 7
|
|
19
19
|
1 0 8 5 +
|
|
20
20
|
-----------
|
|
@@ -7,7 +7,7 @@ letter, the second with the second-last, and so on.
|
|
|
7
7
|
|
|
8
8
|
An Atbash cipher for the Latin alphabet would be as follows:
|
|
9
9
|
|
|
10
|
-
```
|
|
10
|
+
```text
|
|
11
11
|
Plain: abcdefghijklmnopqrstuvwxyz
|
|
12
12
|
Cipher: zyxwvutsrqponmlkjihgfedcba
|
|
13
13
|
```
|
|
@@ -21,6 +21,7 @@ being 5 letters, and punctuation is excluded. This is to make it harder to guess
|
|
|
21
21
|
things based on word boundaries.
|
|
22
22
|
|
|
23
23
|
## Examples
|
|
24
|
+
|
|
24
25
|
- Encoding `test` gives `gvhg`
|
|
25
26
|
- Decoding `gvhg` gives `test`
|
|
26
27
|
- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog`
|
|
@@ -2,7 +2,7 @@ Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles
|
|
|
2
2
|
|
|
3
3
|
Note that not all verses are identical.
|
|
4
4
|
|
|
5
|
-
```
|
|
5
|
+
```text
|
|
6
6
|
99 bottles of beer on the wall, 99 bottles of beer.
|
|
7
7
|
Take one down and pass it around, 98 bottles of beer on the wall.
|
|
8
8
|
|
|
@@ -5,10 +5,12 @@ string, your program should produce a decimal output. The
|
|
|
5
5
|
program should handle invalid inputs.
|
|
6
6
|
|
|
7
7
|
## Note
|
|
8
|
+
|
|
8
9
|
- Implement the conversion yourself.
|
|
9
10
|
Do not use something else to perform the conversion for you.
|
|
10
11
|
|
|
11
12
|
## About Binary (Base-2)
|
|
13
|
+
|
|
12
14
|
Decimal is a base-10 system.
|
|
13
15
|
|
|
14
16
|
A number 23 in base 10 notation can be understood
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
To try and encourage more sales of different books from a popular 5 book
|
|
2
2
|
series, a bookshop has decided to offer discounts on multiple book purchases.
|
|
3
3
|
|
|
4
|
-
One copy of any of the five books costs $8.
|
|
4
|
+
One copy of any of the five books costs $8.
|
|
5
5
|
|
|
6
6
|
If, however, you buy two different books, you get a 5%
|
|
7
7
|
discount on those two books.
|
|
8
8
|
|
|
9
|
-
If you buy 3 different books, you get a 10% discount.
|
|
9
|
+
If you buy 3 different books, you get a 10% discount.
|
|
10
10
|
|
|
11
11
|
If you buy 4 different books, you get a 20% discount.
|
|
12
12
|
|
|
13
|
-
If you buy all 5, you get a 25% discount.
|
|
13
|
+
If you buy all 5, you get a 25% discount.
|
|
14
14
|
|
|
15
15
|
Note: that if you buy four books, of which 3 are
|
|
16
16
|
different titles, you get a 10% discount on the 3 that
|
|
17
|
-
form part of a set, but the fourth book still costs $8.
|
|
17
|
+
form part of a set, but the fourth book still costs $8.
|
|
18
18
|
|
|
19
19
|
Your mission is to write a piece of code to calculate the
|
|
20
20
|
price of any conceivable shopping basket (containing only
|
|
@@ -28,7 +28,7 @@ For example, how much does this basket of books cost?
|
|
|
28
28
|
- 2 copies of the third book
|
|
29
29
|
- 1 copy of the fourth book
|
|
30
30
|
- 1 copy of the fifth book
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
One way of grouping these 8 books is:
|
|
33
33
|
|
|
34
34
|
- 1 group of 5 --> 25% discount (1st,2nd,3rd,4th,5th)
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
Score a bowling game.
|
|
2
2
|
|
|
3
|
-
Bowling is game where players roll a heavy ball to knock down pins
|
|
3
|
+
Bowling is a game where players roll a heavy ball to knock down pins
|
|
4
4
|
arranged in a triangle. Write code to keep track of the score
|
|
5
5
|
of a game of bowling.
|
|
6
6
|
|
|
7
7
|
## Scoring Bowling
|
|
8
8
|
|
|
9
|
-
The game consists of 10 frames. A frame is composed of one or two ball
|
|
9
|
+
The game consists of 10 frames. A frame is composed of one or two ball
|
|
10
|
+
throws with 10 pins standing at frame initialization. There are three
|
|
11
|
+
cases for the tabulation of a frame.
|
|
10
12
|
|
|
11
|
-
* An open frame is where a score of less than 10 is recorded for the
|
|
13
|
+
* An open frame is where a score of less than 10 is recorded for the
|
|
14
|
+
frame. In this case the score for the frame is the number of pins
|
|
15
|
+
knocked down.
|
|
12
16
|
|
|
13
|
-
* A spare is where all ten pins are knocked down
|
|
17
|
+
* A spare is where all ten pins are knocked down by the second
|
|
18
|
+
throw. The total value of a spare is 10 plus the number of pins
|
|
19
|
+
knocked down in their next throw.
|
|
14
20
|
|
|
15
|
-
* A strike is where all ten pins are knocked down
|
|
21
|
+
* A strike is where all ten pins are knocked down by the first
|
|
22
|
+
throw. The total value of a strike is 10 plus the number of pins
|
|
23
|
+
knocked down in the next two throws. If a strike is immediately
|
|
24
|
+
followed by a second strike, then the value of the first strike
|
|
25
|
+
cannot be determined until the ball is thrown one more time.
|
|
16
26
|
|
|
17
27
|
Here is a three frame example:
|
|
18
28
|
|
|
@@ -28,7 +38,11 @@ Frame 3 is (9 + 0) = 9
|
|
|
28
38
|
|
|
29
39
|
This means the current running total is 48.
|
|
30
40
|
|
|
31
|
-
The tenth frame in the game is a special case. If someone throws a
|
|
41
|
+
The tenth frame in the game is a special case. If someone throws a
|
|
42
|
+
strike or a spare then they get a fill ball. Fill balls exist to
|
|
43
|
+
calculate the total of the 10th frame. Scoring a strike or spare on
|
|
44
|
+
the fill ball does not give the player more fill balls. The total
|
|
45
|
+
value of the 10th frame is the total number of pins knocked down.
|
|
32
46
|
|
|
33
47
|
For a tenth frame of X1/ (strike and a spare), the total value is 20.
|
|
34
48
|
|
|
@@ -8,6 +8,7 @@ always reach 1 eventually.
|
|
|
8
8
|
Given a number n, return the number of steps required to reach 1.
|
|
9
9
|
|
|
10
10
|
## Examples
|
|
11
|
+
|
|
11
12
|
Starting with n = 12, the steps would be as follows:
|
|
12
13
|
|
|
13
14
|
0. 12
|
|
@@ -22,4 +23,3 @@ Starting with n = 12, the steps would be as follows:
|
|
|
22
23
|
9. 1
|
|
23
24
|
|
|
24
25
|
Resulting in 9 steps. So for input n = 12, the return value would be 9.
|
|
25
|
-
|
|
@@ -16,7 +16,7 @@ computes the winner (or lack thereof). Note that all games need not be "fair".
|
|
|
16
16
|
The boards look like this (with spaces added for readability, which won't be in
|
|
17
17
|
the representation passed to your code):
|
|
18
18
|
|
|
19
|
-
```
|
|
19
|
+
```text
|
|
20
20
|
. O . X .
|
|
21
21
|
. X X O .
|
|
22
22
|
O O O X .
|
|
@@ -24,7 +24,7 @@ and `r` is the number of rows.
|
|
|
24
24
|
Our normalized text is 54 characters long, dictating a rectangle with
|
|
25
25
|
`c = 8` and `r = 7`:
|
|
26
26
|
|
|
27
|
-
```
|
|
27
|
+
```text
|
|
28
28
|
ifmanwas
|
|
29
29
|
meanttos
|
|
30
30
|
tayonthe
|
|
@@ -39,7 +39,7 @@ right.
|
|
|
39
39
|
|
|
40
40
|
The message above is coded as:
|
|
41
41
|
|
|
42
|
-
```
|
|
42
|
+
```text
|
|
43
43
|
imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
|
|
44
44
|
```
|
|
45
45
|
|
|
@@ -47,14 +47,14 @@ Output the encoded text in chunks. Phrases that fill perfect squares
|
|
|
47
47
|
`(r X r)` should be output in `r`-length chunks separated by spaces.
|
|
48
48
|
Imperfect squares will have `n` empty spaces. Those spaces should be distributed evenly across the last `n` rows.
|
|
49
49
|
|
|
50
|
-
```
|
|
50
|
+
```text
|
|
51
51
|
imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
Notice that were we to stack these, we could visually decode the
|
|
55
55
|
cyphertext back in to the original message:
|
|
56
56
|
|
|
57
|
-
```
|
|
57
|
+
```text
|
|
58
58
|
imtgdvs
|
|
59
59
|
fearwer
|
|
60
60
|
mayoogo
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
The diamond kata takes as its input a letter, and outputs it in a diamond
|
|
2
|
-
shape. Given a letter, it prints a diamond starting with 'A', with the
|
|
1
|
+
The diamond kata takes as its input a letter, and outputs it in a diamond
|
|
2
|
+
shape. Given a letter, it prints a diamond starting with 'A', with the
|
|
3
3
|
supplied letter at the widest point.
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
@@ -13,7 +13,7 @@ supplied letter at the widest point.
|
|
|
13
13
|
* The diamond has a square shape (width equals height).
|
|
14
14
|
* The letters form a diamond shape.
|
|
15
15
|
* The top half has the letters in ascending order.
|
|
16
|
-
* The bottom half has the letters in descending order.
|
|
16
|
+
* The bottom half has the letters in descending order.
|
|
17
17
|
* The four corners (containing the spaces) are triangles.
|
|
18
18
|
|
|
19
19
|
## Examples
|
|
@@ -22,13 +22,13 @@ In the following examples, spaces are indicated by `·` characters.
|
|
|
22
22
|
|
|
23
23
|
Diamond for letter 'A':
|
|
24
24
|
|
|
25
|
-
```
|
|
25
|
+
```text
|
|
26
26
|
A
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
Diamond for letter 'C':
|
|
30
30
|
|
|
31
|
-
```
|
|
31
|
+
```text
|
|
32
32
|
··A··
|
|
33
33
|
·B·B·
|
|
34
34
|
C···C
|
|
@@ -38,7 +38,7 @@ C···C
|
|
|
38
38
|
|
|
39
39
|
Diamond for letter 'E':
|
|
40
40
|
|
|
41
|
-
```
|
|
41
|
+
```text
|
|
42
42
|
····A····
|
|
43
43
|
···B·B···
|
|
44
44
|
··C···C··
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
We are going to do the `Transform` step of an Extract-Transform-Load.
|
|
2
2
|
|
|
3
3
|
### ETL
|
|
4
|
+
|
|
4
5
|
Extract-Transform-Load (ETL) is a fancy way of saying, "We have some crufty, legacy data over in this system, and now we need it in this shiny new system over here, so
|
|
5
6
|
we're going to migrate this."
|
|
6
7
|
|
|
@@ -9,6 +10,7 @@ once." That's then typically followed by much forehead slapping and
|
|
|
9
10
|
moaning about how stupid we could possibly be.)
|
|
10
11
|
|
|
11
12
|
### The goal
|
|
13
|
+
|
|
12
14
|
We're going to extract some scrabble scores from a legacy system.
|
|
13
15
|
|
|
14
16
|
The old system stored a list of letters per score:
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
Take a nested list and return a single flattened list with all values except nil/null.
|
|
2
2
|
|
|
3
3
|
The challenge is to write a function that accepts an arbitrarily-deep nested list-like structure and returns a flattened structure without any nil/null values.
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
For Example
|
|
6
6
|
|
|
7
7
|
input: [1,[2,3,null,4],[null],5]
|
|
8
8
|
|
|
9
9
|
output: [1,2,3,4,5]
|
|
10
|
-
|
|
@@ -14,7 +14,7 @@ only horizontal and vertical neighbours count. In the following diagram
|
|
|
14
14
|
the stones which matter are marked "O" and the stones that don't are
|
|
15
15
|
marked "I" (ignored). Empty spaces represent empty intersections.
|
|
16
16
|
|
|
17
|
-
```
|
|
17
|
+
```text
|
|
18
18
|
+----+
|
|
19
19
|
|IOOI|
|
|
20
20
|
|O O|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Search a file for lines matching a regular expression pattern. Return the line
|
|
2
2
|
number and contents of each matching line.
|
|
3
3
|
|
|
4
|
-
The Unix [`grep`](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html) command can be used to search for lines in one or more files
|
|
4
|
+
The Unix [`grep`](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html) command can be used to search for lines in one or more files
|
|
5
5
|
that match a user-provided search query (known as the *pattern*).
|
|
6
6
|
|
|
7
7
|
The `grep` command takes three arguments:
|
|
8
8
|
|
|
9
|
-
1. The pattern used to match lines in a file.
|
|
9
|
+
1. The pattern used to match lines in a file.
|
|
10
10
|
2. Zero or more flags to customize the matching behavior.
|
|
11
|
-
3. One or more files in which to search for matching lines.
|
|
11
|
+
3. One or more files in which to search for matching lines.
|
|
12
12
|
|
|
13
13
|
Your task is to implement the `grep` function, which should read the contents
|
|
14
14
|
of the specified files, find the lines that match the specified pattern
|
|
@@ -18,18 +18,18 @@ in the first file being output first.
|
|
|
18
18
|
|
|
19
19
|
As an example, suppose there is a file named "input.txt" with the following contents:
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
```text
|
|
22
22
|
hello
|
|
23
23
|
world
|
|
24
24
|
hello again
|
|
25
|
-
|
|
25
|
+
```
|
|
26
26
|
|
|
27
27
|
If we were to call `grep "hello" input.txt`, the returned string should be:
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
```text
|
|
30
30
|
hello
|
|
31
31
|
hello again
|
|
32
|
-
|
|
32
|
+
```
|
|
33
33
|
|
|
34
34
|
### Flags
|
|
35
35
|
|
|
@@ -44,18 +44,18 @@ As said earlier, the `grep` command should also support the following flags:
|
|
|
44
44
|
If we run `grep -n "hello" input.txt`, the `-n` flag will require the matching
|
|
45
45
|
lines to be prefixed with its line number:
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
```text
|
|
48
48
|
1:hello
|
|
49
49
|
3:hello again
|
|
50
|
-
|
|
50
|
+
```
|
|
51
51
|
|
|
52
|
-
And if we run `grep -i "HELLO" input.txt`, we'll do a case-insensitive match,
|
|
52
|
+
And if we run `grep -i "HELLO" input.txt`, we'll do a case-insensitive match,
|
|
53
53
|
and the output will be:
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
```text
|
|
56
56
|
hello
|
|
57
57
|
hello again
|
|
58
|
-
|
|
58
|
+
```
|
|
59
59
|
|
|
60
60
|
The `grep` command should support multiple flags at once.
|
|
61
61
|
|