Просмотр исходного кода

Generate the exercise READMEs from the new templates

Katrina Owen 9 лет назад
Родитель
Сommit
5671e6bf86
82 измененных файлов: 4222 добавлений и 0 удалений
  1. 47
    0
      exercises/accumulate/README.md
  2. 27
    0
      exercises/acronym/README.md
  3. 47
    0
      exercises/all-your-base/README.md
  4. 49
    0
      exercises/allergies/README.md
  5. 25
    0
      exercises/anagram/README.md
  6. 46
    0
      exercises/atbash-cipher/README.md
  7. 54
    0
      exercises/bank-account/README.md
  8. 339
    0
      exercises/beer-song/README.md
  9. 72
    0
      exercises/binary-search-tree/README.md
  10. 53
    0
      exercises/binary-search/README.md
  11. 47
    0
      exercises/binary/README.md
  12. 30
    0
      exercises/bob/README.md
  13. 86
    0
      exercises/book-store/README.md
  14. 65
    0
      exercises/bowling/README.md
  15. 22
    0
      exercises/bracket-push/README.md
  16. 35
    0
      exercises/change/README.md
  17. 62
    0
      exercises/circular-buffer/README.md
  18. 30
    0
      exercises/clock/README.md
  19. 45
    0
      exercises/collatz-conjecture/README.md
  20. 23
    0
      exercises/complex-numbers/README.md
  21. 86
    0
      exercises/crypto-square/README.md
  22. 23
    0
      exercises/custom-set/README.md
  23. 71
    0
      exercises/diamond/README.md
  24. 31
    0
      exercises/difference-of-squares/README.md
  25. 63
    0
      exercises/etl/README.md
  26. 30
    0
      exercises/flatten-array/README.md
  27. 82
    0
      exercises/food-chain/README.md
  28. 23
    0
      exercises/gigasecond/README.md
  29. 54
    0
      exercises/grade-school/README.md
  30. 68
    0
      exercises/hamming/README.md
  31. 39
    0
      exercises/hello-world/README.md
  32. 26
    0
      exercises/hexadecimal/README.md
  33. 42
    0
      exercises/isogram/README.md
  34. 78
    0
      exercises/kindergarten-garden/README.md
  35. 32
    0
      exercises/largest-series-product/README.md
  36. 46
    0
      exercises/linked-list/README.md
  37. 27
    0
      exercises/list-ops/README.md
  38. 83
    0
      exercises/luhn/README.md
  39. 57
    0
      exercises/matrix/README.md
  40. 42
    0
      exercises/meetup/README.md
  41. 42
    0
      exercises/minesweeper/README.md
  42. 27
    0
      exercises/nth-prime/README.md
  43. 45
    0
      exercises/nucleotide-count/README.md
  44. 97
    0
      exercises/ocr-numbers/README.md
  45. 61
    0
      exercises/octal/README.md
  46. 52
    0
      exercises/palindrome-products/README.md
  47. 27
    0
      exercises/pangram/README.md
  48. 33
    0
      exercises/pascals-triangle/README.md
  49. 36
    0
      exercises/perfect-numbers/README.md
  50. 46
    0
      exercises/phone-number/README.md
  51. 36
    0
      exercises/pig-latin/README.md
  52. 24
    0
      exercises/poker/README.md
  53. 48
    0
      exercises/prime-factors/README.md
  54. 36
    0
      exercises/pythagorean-triplet/README.md
  55. 45
    0
      exercises/queen-attack/README.md
  56. 36
    0
      exercises/raindrops/README.md
  57. 79
    0
      exercises/rectangles/README.md
  58. 37
    0
      exercises/rna-transcription/README.md
  59. 34
    0
      exercises/robot-name/README.md
  60. 46
    0
      exercises/robot-simulator/README.md
  61. 61
    0
      exercises/roman-numerals/README.md
  62. 42
    0
      exercises/run-length-encoding/README.md
  63. 45
    0
      exercises/saddle-points/README.md
  64. 56
    0
      exercises/scrabble-score/README.md
  65. 47
    0
      exercises/secret-handshake/README.md
  66. 39
    0
      exercises/series/README.md
  67. 46
    0
      exercises/sieve/README.md
  68. 109
    0
      exercises/simple-cipher/README.md
  69. 40
    0
      exercises/simple-linked-list/README.md
  70. 36
    0
      exercises/space-age/README.md
  71. 42
    0
      exercises/spiral-matrix/README.md
  72. 52
    0
      exercises/strain/README.md
  73. 33
    0
      exercises/sublist/README.md
  74. 30
    0
      exercises/sum-of-multiples/README.md
  75. 77
    0
      exercises/transpose/README.md
  76. 38
    0
      exercises/triangle/README.md
  77. 40
    0
      exercises/trinary/README.md
  78. 47
    0
      exercises/twelve-days/README.md
  79. 100
    0
      exercises/two-fer/README.md
  80. 31
    0
      exercises/word-count/README.md
  81. 42
    0
      exercises/word-search/README.md
  82. 75
    0
      exercises/wordy/README.md

+ 47
- 0
exercises/accumulate/README.md Просмотреть файл

@@ -0,0 +1,47 @@
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
+Lisp specific: it's perfectly fine to use `MAPCAR` or the equivalent,
29
+as this is idiomatic Lisp, not a library function.
30
+
31
+
32
+To run the tests:
33
+
34
+```sh
35
+$ gradle test
36
+```
37
+
38
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
39
+
40
+
41
+## Source
42
+
43
+Conversation with James Edward Gray II [https://twitter.com/jeg2](https://twitter.com/jeg2)
44
+
45
+## Submitting Incomplete Solutions
46
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
47
+

+ 27
- 0
exercises/acronym/README.md Просмотреть файл

@@ -0,0 +1,27 @@
1
+# Acronym
2
+
3
+Convert a phrase to its acronym.
4
+
5
+Techies love their TLA (Three Letter Acronyms)!
6
+
7
+Help generate some jargon by writing a program that converts a long name
8
+like Portable Network Graphics to its acronym (PNG).
9
+
10
+
11
+
12
+To run the tests:
13
+
14
+```sh
15
+$ gradle test
16
+```
17
+
18
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
19
+
20
+
21
+## Source
22
+
23
+Julien Vanier [https://github.com/monkbroc](https://github.com/monkbroc)
24
+
25
+## Submitting Incomplete Solutions
26
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
27
+

+ 47
- 0
exercises/all-your-base/README.md Просмотреть файл

@@ -0,0 +1,47 @@
1
+# All Your Base
2
+
3
+Convert a number, represented as a sequence of digits in one base, to any other base.
4
+
5
+Implement general base conversion. Given a number in base **a**,
6
+represented as a sequence of digits, convert it to base **b**.
7
+
8
+## Note
9
+- Try to implement the conversion yourself.
10
+  Do not use something else to perform the conversion for you.
11
+
12
+## About [Positional Notation](https://en.wikipedia.org/wiki/Positional_notation)
13
+
14
+In positional notation, a number in base **b** can be understood as a linear
15
+combination of powers of **b**.
16
+
17
+The number 42, *in base 10*, means:
18
+
19
+(4 * 10^1) + (2 * 10^0)
20
+
21
+The number 101010, *in base 2*, means:
22
+
23
+(1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (0 * 2^0)
24
+
25
+The number 1120, *in base 3*, means:
26
+
27
+(1 * 3^3) + (1 * 3^2) + (2 * 3^1) + (0 * 3^0)
28
+
29
+I think you got the idea!
30
+
31
+
32
+*Yes. Those three numbers above are exactly the same. Congratulations!*
33
+
34
+
35
+To run the tests:
36
+
37
+```sh
38
+$ gradle test
39
+```
40
+
41
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
42
+
43
+
44
+
45
+## Submitting Incomplete Solutions
46
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
47
+

+ 49
- 0
exercises/allergies/README.md Просмотреть файл

@@ -0,0 +1,49 @@
1
+# Allergies
2
+
3
+Given a person's allergy score, determine whether or not they're allergic to a given item, and their full list of allergies.
4
+
5
+An allergy test produces a single numeric score which contains the
6
+information about all the allergies the person has (that they were
7
+tested for).
8
+
9
+The list of items (and their value) that were tested are:
10
+
11
+* eggs (1)
12
+* peanuts (2)
13
+* shellfish (4)
14
+* strawberries (8)
15
+* tomatoes (16)
16
+* chocolate (32)
17
+* pollen (64)
18
+* cats (128)
19
+
20
+So if Tom is allergic to peanuts and chocolate, he gets a score of 34.
21
+
22
+Now, given just that score of 34, your program should be able to say:
23
+
24
+- Whether Tom is allergic to any one of those allergens listed above.
25
+- All the allergens Tom is allergic to.
26
+
27
+Note: a given score may include allergens **not** listed above (i.e.
28
+allergens that score 256, 512, 1024, etc.).  Your program should
29
+ignore those components of the score.  For example, if the allergy
30
+score is 257, your program should only report the eggs (1) allergy.
31
+
32
+
33
+
34
+To run the tests:
35
+
36
+```sh
37
+$ gradle test
38
+```
39
+
40
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
41
+
42
+
43
+## Source
44
+
45
+Jumpstart Lab Warm-up [http://jumpstartlab.com](http://jumpstartlab.com)
46
+
47
+## Submitting Incomplete Solutions
48
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
49
+

+ 25
- 0
exercises/anagram/README.md Просмотреть файл

@@ -0,0 +1,25 @@
1
+# Anagram
2
+
3
+Given a word and a list of possible anagrams, select the correct sublist.
4
+
5
+Given `"listen"` and a list of candidates like `"enlists" "google"
6
+"inlets" "banana"` the program should return a list containing
7
+`"inlets"`.
8
+
9
+
10
+To run the tests:
11
+
12
+```sh
13
+$ gradle test
14
+```
15
+
16
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
17
+
18
+
19
+## Source
20
+
21
+Inspired by the Extreme Startup game [https://github.com/rchatley/extreme_startup](https://github.com/rchatley/extreme_startup)
22
+
23
+## Submitting Incomplete Solutions
24
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
25
+

+ 46
- 0
exercises/atbash-cipher/README.md Просмотреть файл

@@ -0,0 +1,46 @@
1
+# Atbash Cipher
2
+
3
+Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
4
+
5
+The Atbash cipher is a simple substitution cipher that relies on
6
+transposing all the letters in the alphabet such that the resulting
7
+alphabet is backwards. The first letter is replaced with the last
8
+letter, the second with the second-last, and so on.
9
+
10
+An Atbash cipher for the Latin alphabet would be as follows:
11
+
12
+```plain
13
+Plain:  abcdefghijklmnopqrstuvwxyz
14
+Cipher: zyxwvutsrqponmlkjihgfedcba
15
+```
16
+
17
+It is a very weak cipher because it only has one possible key, and it is
18
+a simple monoalphabetic substitution cipher. However, this may not have
19
+been an issue in the cipher's time.
20
+
21
+Ciphertext is written out in groups of fixed length, the traditional group size
22
+being 5 letters, and punctuation is excluded. This is to make it harder to guess
23
+things based on word boundaries.
24
+
25
+## Examples
26
+- Encoding `test` gives `gvhg`
27
+- Decoding `gvhg` gives `test`
28
+- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog`
29
+
30
+
31
+To run the tests:
32
+
33
+```sh
34
+$ gradle test
35
+```
36
+
37
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
38
+
39
+
40
+## Source
41
+
42
+Wikipedia [http://en.wikipedia.org/wiki/Atbash](http://en.wikipedia.org/wiki/Atbash)
43
+
44
+## Submitting Incomplete Solutions
45
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
46
+

+ 54
- 0
exercises/bank-account/README.md Просмотреть файл

@@ -0,0 +1,54 @@
1
+# Bank Account
2
+
3
+Simulate a bank account supporting opening/closing, withdrawals, and deposits
4
+of money. Watch out for concurrent transactions!
5
+
6
+A bank account can be accessed in multiple ways. Clients can make
7
+deposits and withdrawals using the internet, mobile phones, etc. Shops
8
+can charge against the account.
9
+
10
+Create an account that can be accessed from multiple threads/processes
11
+(terminology depends on your programming language).
12
+
13
+It should be possible to close an account; operations against a closed
14
+account must fail.
15
+
16
+## Instructions
17
+
18
+Run the test file, and fix each of the errors in turn. When you get the
19
+first test to pass, go to the first pending or skipped test, and make
20
+that pass as well. When all of the tests are passing, feel free to
21
+submit.
22
+
23
+Remember that passing code is just the first step. The goal is to work
24
+towards a solution that is as readable and expressive as you can make
25
+it.
26
+
27
+Have fun!
28
+
29
+This exercise introduces [concurrency](https://docs.oracle.com/javase/tutorial/essential/concurrency/index.html). 
30
+To pass the last test you might find the 
31
+[`synchronized` keyword or locks](https://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html) useful.
32
+
33
+Problems arising from running code concurrently are often intermittent because they depend on the order the code is
34
+executed. Therefore the last test runs many [threads](https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html) 
35
+several times to increase the chances of catching a bug. That means this test should fail if your implementation is not
36
+[thread safe](https://en.wikipedia.org/wiki/Thread_safety), but there is a chance it will pass just because there was 
37
+no concurrent modification attempt. It is unlikely that this will occur several times 
38
+in a row since the order the code is executed should vary every time you run the test. So if you run the last test a 
39
+couple of times and it passes every time then you can be reasonably sure that your implementation is correct.
40
+
41
+
42
+To run the tests:
43
+
44
+```sh
45
+$ gradle test
46
+```
47
+
48
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
49
+
50
+
51
+
52
+## Submitting Incomplete Solutions
53
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
54
+

+ 339
- 0
exercises/beer-song/README.md Просмотреть файл

@@ -0,0 +1,339 @@
1
+# Beer Song
2
+
3
+Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.
4
+
5
+Note that not all verses are identical.
6
+
7
+```plain
8
+99 bottles of beer on the wall, 99 bottles of beer.
9
+Take one down and pass it around, 98 bottles of beer on the wall.
10
+
11
+98 bottles of beer on the wall, 98 bottles of beer.
12
+Take one down and pass it around, 97 bottles of beer on the wall.
13
+
14
+97 bottles of beer on the wall, 97 bottles of beer.
15
+Take one down and pass it around, 96 bottles of beer on the wall.
16
+
17
+96 bottles of beer on the wall, 96 bottles of beer.
18
+Take one down and pass it around, 95 bottles of beer on the wall.
19
+
20
+95 bottles of beer on the wall, 95 bottles of beer.
21
+Take one down and pass it around, 94 bottles of beer on the wall.
22
+
23
+94 bottles of beer on the wall, 94 bottles of beer.
24
+Take one down and pass it around, 93 bottles of beer on the wall.
25
+
26
+93 bottles of beer on the wall, 93 bottles of beer.
27
+Take one down and pass it around, 92 bottles of beer on the wall.
28
+
29
+92 bottles of beer on the wall, 92 bottles of beer.
30
+Take one down and pass it around, 91 bottles of beer on the wall.
31
+
32
+91 bottles of beer on the wall, 91 bottles of beer.
33
+Take one down and pass it around, 90 bottles of beer on the wall.
34
+
35
+90 bottles of beer on the wall, 90 bottles of beer.
36
+Take one down and pass it around, 89 bottles of beer on the wall.
37
+
38
+89 bottles of beer on the wall, 89 bottles of beer.
39
+Take one down and pass it around, 88 bottles of beer on the wall.
40
+
41
+88 bottles of beer on the wall, 88 bottles of beer.
42
+Take one down and pass it around, 87 bottles of beer on the wall.
43
+
44
+87 bottles of beer on the wall, 87 bottles of beer.
45
+Take one down and pass it around, 86 bottles of beer on the wall.
46
+
47
+86 bottles of beer on the wall, 86 bottles of beer.
48
+Take one down and pass it around, 85 bottles of beer on the wall.
49
+
50
+85 bottles of beer on the wall, 85 bottles of beer.
51
+Take one down and pass it around, 84 bottles of beer on the wall.
52
+
53
+84 bottles of beer on the wall, 84 bottles of beer.
54
+Take one down and pass it around, 83 bottles of beer on the wall.
55
+
56
+83 bottles of beer on the wall, 83 bottles of beer.
57
+Take one down and pass it around, 82 bottles of beer on the wall.
58
+
59
+82 bottles of beer on the wall, 82 bottles of beer.
60
+Take one down and pass it around, 81 bottles of beer on the wall.
61
+
62
+81 bottles of beer on the wall, 81 bottles of beer.
63
+Take one down and pass it around, 80 bottles of beer on the wall.
64
+
65
+80 bottles of beer on the wall, 80 bottles of beer.
66
+Take one down and pass it around, 79 bottles of beer on the wall.
67
+
68
+79 bottles of beer on the wall, 79 bottles of beer.
69
+Take one down and pass it around, 78 bottles of beer on the wall.
70
+
71
+78 bottles of beer on the wall, 78 bottles of beer.
72
+Take one down and pass it around, 77 bottles of beer on the wall.
73
+
74
+77 bottles of beer on the wall, 77 bottles of beer.
75
+Take one down and pass it around, 76 bottles of beer on the wall.
76
+
77
+76 bottles of beer on the wall, 76 bottles of beer.
78
+Take one down and pass it around, 75 bottles of beer on the wall.
79
+
80
+75 bottles of beer on the wall, 75 bottles of beer.
81
+Take one down and pass it around, 74 bottles of beer on the wall.
82
+
83
+74 bottles of beer on the wall, 74 bottles of beer.
84
+Take one down and pass it around, 73 bottles of beer on the wall.
85
+
86
+73 bottles of beer on the wall, 73 bottles of beer.
87
+Take one down and pass it around, 72 bottles of beer on the wall.
88
+
89
+72 bottles of beer on the wall, 72 bottles of beer.
90
+Take one down and pass it around, 71 bottles of beer on the wall.
91
+
92
+71 bottles of beer on the wall, 71 bottles of beer.
93
+Take one down and pass it around, 70 bottles of beer on the wall.
94
+
95
+70 bottles of beer on the wall, 70 bottles of beer.
96
+Take one down and pass it around, 69 bottles of beer on the wall.
97
+
98
+69 bottles of beer on the wall, 69 bottles of beer.
99
+Take one down and pass it around, 68 bottles of beer on the wall.
100
+
101
+68 bottles of beer on the wall, 68 bottles of beer.
102
+Take one down and pass it around, 67 bottles of beer on the wall.
103
+
104
+67 bottles of beer on the wall, 67 bottles of beer.
105
+Take one down and pass it around, 66 bottles of beer on the wall.
106
+
107
+66 bottles of beer on the wall, 66 bottles of beer.
108
+Take one down and pass it around, 65 bottles of beer on the wall.
109
+
110
+65 bottles of beer on the wall, 65 bottles of beer.
111
+Take one down and pass it around, 64 bottles of beer on the wall.
112
+
113
+64 bottles of beer on the wall, 64 bottles of beer.
114
+Take one down and pass it around, 63 bottles of beer on the wall.
115
+
116
+63 bottles of beer on the wall, 63 bottles of beer.
117
+Take one down and pass it around, 62 bottles of beer on the wall.
118
+
119
+62 bottles of beer on the wall, 62 bottles of beer.
120
+Take one down and pass it around, 61 bottles of beer on the wall.
121
+
122
+61 bottles of beer on the wall, 61 bottles of beer.
123
+Take one down and pass it around, 60 bottles of beer on the wall.
124
+
125
+60 bottles of beer on the wall, 60 bottles of beer.
126
+Take one down and pass it around, 59 bottles of beer on the wall.
127
+
128
+59 bottles of beer on the wall, 59 bottles of beer.
129
+Take one down and pass it around, 58 bottles of beer on the wall.
130
+
131
+58 bottles of beer on the wall, 58 bottles of beer.
132
+Take one down and pass it around, 57 bottles of beer on the wall.
133
+
134
+57 bottles of beer on the wall, 57 bottles of beer.
135
+Take one down and pass it around, 56 bottles of beer on the wall.
136
+
137
+56 bottles of beer on the wall, 56 bottles of beer.
138
+Take one down and pass it around, 55 bottles of beer on the wall.
139
+
140
+55 bottles of beer on the wall, 55 bottles of beer.
141
+Take one down and pass it around, 54 bottles of beer on the wall.
142
+
143
+54 bottles of beer on the wall, 54 bottles of beer.
144
+Take one down and pass it around, 53 bottles of beer on the wall.
145
+
146
+53 bottles of beer on the wall, 53 bottles of beer.
147
+Take one down and pass it around, 52 bottles of beer on the wall.
148
+
149
+52 bottles of beer on the wall, 52 bottles of beer.
150
+Take one down and pass it around, 51 bottles of beer on the wall.
151
+
152
+51 bottles of beer on the wall, 51 bottles of beer.
153
+Take one down and pass it around, 50 bottles of beer on the wall.
154
+
155
+50 bottles of beer on the wall, 50 bottles of beer.
156
+Take one down and pass it around, 49 bottles of beer on the wall.
157
+
158
+49 bottles of beer on the wall, 49 bottles of beer.
159
+Take one down and pass it around, 48 bottles of beer on the wall.
160
+
161
+48 bottles of beer on the wall, 48 bottles of beer.
162
+Take one down and pass it around, 47 bottles of beer on the wall.
163
+
164
+47 bottles of beer on the wall, 47 bottles of beer.
165
+Take one down and pass it around, 46 bottles of beer on the wall.
166
+
167
+46 bottles of beer on the wall, 46 bottles of beer.
168
+Take one down and pass it around, 45 bottles of beer on the wall.
169
+
170
+45 bottles of beer on the wall, 45 bottles of beer.
171
+Take one down and pass it around, 44 bottles of beer on the wall.
172
+
173
+44 bottles of beer on the wall, 44 bottles of beer.
174
+Take one down and pass it around, 43 bottles of beer on the wall.
175
+
176
+43 bottles of beer on the wall, 43 bottles of beer.
177
+Take one down and pass it around, 42 bottles of beer on the wall.
178
+
179
+42 bottles of beer on the wall, 42 bottles of beer.
180
+Take one down and pass it around, 41 bottles of beer on the wall.
181
+
182
+41 bottles of beer on the wall, 41 bottles of beer.
183
+Take one down and pass it around, 40 bottles of beer on the wall.
184
+
185
+40 bottles of beer on the wall, 40 bottles of beer.
186
+Take one down and pass it around, 39 bottles of beer on the wall.
187
+
188
+39 bottles of beer on the wall, 39 bottles of beer.
189
+Take one down and pass it around, 38 bottles of beer on the wall.
190
+
191
+38 bottles of beer on the wall, 38 bottles of beer.
192
+Take one down and pass it around, 37 bottles of beer on the wall.
193
+
194
+37 bottles of beer on the wall, 37 bottles of beer.
195
+Take one down and pass it around, 36 bottles of beer on the wall.
196
+
197
+36 bottles of beer on the wall, 36 bottles of beer.
198
+Take one down and pass it around, 35 bottles of beer on the wall.
199
+
200
+35 bottles of beer on the wall, 35 bottles of beer.
201
+Take one down and pass it around, 34 bottles of beer on the wall.
202
+
203
+34 bottles of beer on the wall, 34 bottles of beer.
204
+Take one down and pass it around, 33 bottles of beer on the wall.
205
+
206
+33 bottles of beer on the wall, 33 bottles of beer.
207
+Take one down and pass it around, 32 bottles of beer on the wall.
208
+
209
+32 bottles of beer on the wall, 32 bottles of beer.
210
+Take one down and pass it around, 31 bottles of beer on the wall.
211
+
212
+31 bottles of beer on the wall, 31 bottles of beer.
213
+Take one down and pass it around, 30 bottles of beer on the wall.
214
+
215
+30 bottles of beer on the wall, 30 bottles of beer.
216
+Take one down and pass it around, 29 bottles of beer on the wall.
217
+
218
+29 bottles of beer on the wall, 29 bottles of beer.
219
+Take one down and pass it around, 28 bottles of beer on the wall.
220
+
221
+28 bottles of beer on the wall, 28 bottles of beer.
222
+Take one down and pass it around, 27 bottles of beer on the wall.
223
+
224
+27 bottles of beer on the wall, 27 bottles of beer.
225
+Take one down and pass it around, 26 bottles of beer on the wall.
226
+
227
+26 bottles of beer on the wall, 26 bottles of beer.
228
+Take one down and pass it around, 25 bottles of beer on the wall.
229
+
230
+25 bottles of beer on the wall, 25 bottles of beer.
231
+Take one down and pass it around, 24 bottles of beer on the wall.
232
+
233
+24 bottles of beer on the wall, 24 bottles of beer.
234
+Take one down and pass it around, 23 bottles of beer on the wall.
235
+
236
+23 bottles of beer on the wall, 23 bottles of beer.
237
+Take one down and pass it around, 22 bottles of beer on the wall.
238
+
239
+22 bottles of beer on the wall, 22 bottles of beer.
240
+Take one down and pass it around, 21 bottles of beer on the wall.
241
+
242
+21 bottles of beer on the wall, 21 bottles of beer.
243
+Take one down and pass it around, 20 bottles of beer on the wall.
244
+
245
+20 bottles of beer on the wall, 20 bottles of beer.
246
+Take one down and pass it around, 19 bottles of beer on the wall.
247
+
248
+19 bottles of beer on the wall, 19 bottles of beer.
249
+Take one down and pass it around, 18 bottles of beer on the wall.
250
+
251
+18 bottles of beer on the wall, 18 bottles of beer.
252
+Take one down and pass it around, 17 bottles of beer on the wall.
253
+
254
+17 bottles of beer on the wall, 17 bottles of beer.
255
+Take one down and pass it around, 16 bottles of beer on the wall.
256
+
257
+16 bottles of beer on the wall, 16 bottles of beer.
258
+Take one down and pass it around, 15 bottles of beer on the wall.
259
+
260
+15 bottles of beer on the wall, 15 bottles of beer.
261
+Take one down and pass it around, 14 bottles of beer on the wall.
262
+
263
+14 bottles of beer on the wall, 14 bottles of beer.
264
+Take one down and pass it around, 13 bottles of beer on the wall.
265
+
266
+13 bottles of beer on the wall, 13 bottles of beer.
267
+Take one down and pass it around, 12 bottles of beer on the wall.
268
+
269
+12 bottles of beer on the wall, 12 bottles of beer.
270
+Take one down and pass it around, 11 bottles of beer on the wall.
271
+
272
+11 bottles of beer on the wall, 11 bottles of beer.
273
+Take one down and pass it around, 10 bottles of beer on the wall.
274
+
275
+10 bottles of beer on the wall, 10 bottles of beer.
276
+Take one down and pass it around, 9 bottles of beer on the wall.
277
+
278
+9 bottles of beer on the wall, 9 bottles of beer.
279
+Take one down and pass it around, 8 bottles of beer on the wall.
280
+
281
+8 bottles of beer on the wall, 8 bottles of beer.
282
+Take one down and pass it around, 7 bottles of beer on the wall.
283
+
284
+7 bottles of beer on the wall, 7 bottles of beer.
285
+Take one down and pass it around, 6 bottles of beer on the wall.
286
+
287
+6 bottles of beer on the wall, 6 bottles of beer.
288
+Take one down and pass it around, 5 bottles of beer on the wall.
289
+
290
+5 bottles of beer on the wall, 5 bottles of beer.
291
+Take one down and pass it around, 4 bottles of beer on the wall.
292
+
293
+4 bottles of beer on the wall, 4 bottles of beer.
294
+Take one down and pass it around, 3 bottles of beer on the wall.
295
+
296
+3 bottles of beer on the wall, 3 bottles of beer.
297
+Take one down and pass it around, 2 bottles of beer on the wall.
298
+
299
+2 bottles of beer on the wall, 2 bottles of beer.
300
+Take one down and pass it around, 1 bottle of beer on the wall.
301
+
302
+1 bottle of beer on the wall, 1 bottle of beer.
303
+Take it down and pass it around, no more bottles of beer on the wall.
304
+
305
+No more bottles of beer on the wall, no more bottles of beer.
306
+Go to the store and buy some more, 99 bottles of beer on the wall.
307
+```
308
+
309
+## For bonus points
310
+
311
+Did you get the tests passing and the code clean? If you want to, these
312
+are some additional things you could try:
313
+
314
+* Remove as much duplication as you possibly can.
315
+* Optimize for readability, even if it means introducing duplication.
316
+* If you've removed all the duplication, do you have a lot of
317
+  conditionals? Try replacing the conditionals with polymorphism, if it
318
+  applies in this language. How readable is it?
319
+
320
+Then please share your thoughts in a comment on the submission. Did this
321
+experiment make the code better? Worse? Did you learn anything from it?
322
+
323
+
324
+To run the tests:
325
+
326
+```sh
327
+$ gradle test
328
+```
329
+
330
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
331
+
332
+
333
+## Source
334
+
335
+Learn to Program by Chris Pine [http://pine.fm/LearnToProgram/?Chapter=06](http://pine.fm/LearnToProgram/?Chapter=06)
336
+
337
+## Submitting Incomplete Solutions
338
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
339
+

+ 72
- 0
exercises/binary-search-tree/README.md Просмотреть файл

@@ -0,0 +1,72 @@
1
+# Binary Search Tree
2
+
3
+Insert and search for numbers in a binary tree.
4
+
5
+When we need to represent sorted data, an array does not make a good
6
+data structure.
7
+
8
+Say we have the array `[1, 3, 4, 5]`, and we add 2 to it so it becomes
9
+`[1, 3, 4, 5, 2]` now we must sort the entire array again! We can
10
+improve on this by realizing that we only need to make space for the new
11
+item `[1, nil, 3, 4, 5]`, and then adding the item in the space we
12
+added. But this still requires us to shift many elements down by one.
13
+
14
+Binary Search Trees, however, can operate on sorted data much more
15
+efficiently.
16
+
17
+A binary search tree consists of a series of connected nodes. Each node
18
+contains a piece of data (e.g. the number 3), a variable named `left`,
19
+and a variable named `right`. The `left` and `right` variables point at
20
+`nil`, or other nodes. Since these other nodes in turn have other nodes
21
+beneath them, we say that the left and right variables are pointing at
22
+subtrees. All data in the left subtree is less than or equal to the
23
+current node's data, and all data in the right subtree is greater than
24
+the current node's data.
25
+
26
+For example, if we had a node containing the data 4, and we added the
27
+data 2, our tree would look like this:
28
+
29
+      4
30
+     /
31
+    2
32
+
33
+If we then added 6, it would look like this:
34
+
35
+      4
36
+     / \
37
+    2   6
38
+
39
+If we then added 3, it would look like this
40
+
41
+       4
42
+     /   \
43
+    2     6
44
+     \
45
+      3
46
+
47
+And if we then added 1, 5, and 7, it would look like this
48
+
49
+          4
50
+        /   \
51
+       /     \
52
+      2       6
53
+     / \     / \
54
+    1   3   5   7
55
+
56
+
57
+To run the tests:
58
+
59
+```sh
60
+$ gradle test
61
+```
62
+
63
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
64
+
65
+
66
+## Source
67
+
68
+Josh Cheek [https://twitter.com/josh_cheek](https://twitter.com/josh_cheek)
69
+
70
+## Submitting Incomplete Solutions
71
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
72
+

+ 53
- 0
exercises/binary-search/README.md Просмотреть файл

@@ -0,0 +1,53 @@
1
+# Binary Search
2
+
3
+Implement a binary search algorithm.
4
+
5
+Searching a sorted collection is a common task. A dictionary is a sorted
6
+list of word definitions. Given a word, one can find its definition. A
7
+telephone book is a sorted list of people's names, addresses, and
8
+telephone numbers. Knowing someone's name allows one to quickly find
9
+their telephone number and address.
10
+
11
+If the list to be searched contains more than a few items (a dozen, say)
12
+a binary search will require far fewer comparisons than a linear search,
13
+but it imposes the requirement that the list be sorted.
14
+
15
+In computer science, a binary search or half-interval search algorithm
16
+finds the position of a specified input value (the search "key") within
17
+an array sorted by key value.
18
+
19
+In each step, the algorithm compares the search key value with the key
20
+value of the middle element of the array.
21
+
22
+If the keys match, then a matching element has been found and its index,
23
+or position, is returned.
24
+
25
+Otherwise, if the search key is less than the middle element's key, then
26
+the algorithm repeats its action on the sub-array to the left of the
27
+middle element or, if the search key is greater, on the sub-array to the
28
+right.
29
+
30
+If the remaining array to be searched is empty, then the key cannot be
31
+found in the array and a special "not found" indication is returned.
32
+
33
+A binary search halves the number of items to check with each iteration,
34
+so locating an item (or determining its absence) takes logarithmic time.
35
+A binary search is a dichotomic divide and conquer search algorithm.
36
+
37
+
38
+To run the tests:
39
+
40
+```sh
41
+$ gradle test
42
+```
43
+
44
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
45
+
46
+
47
+## Source
48
+
49
+Wikipedia [http://en.wikipedia.org/wiki/Binary_search_algorithm](http://en.wikipedia.org/wiki/Binary_search_algorithm)
50
+
51
+## Submitting Incomplete Solutions
52
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
53
+

+ 47
- 0
exercises/binary/README.md Просмотреть файл

@@ -0,0 +1,47 @@
1
+# Binary
2
+
3
+Convert a binary number, represented as a string (e.g. '101010'), to its decimal equivalent using first principles.
4
+
5
+Implement binary to decimal conversion. Given a binary input
6
+string, your program should produce a decimal output. The
7
+program should handle invalid inputs.
8
+
9
+## Note
10
+- Implement the conversion yourself.
11
+  Do not use something else to perform the conversion for you.
12
+
13
+## About Binary (Base-2)
14
+Decimal is a base-10 system.
15
+
16
+A number 23 in base 10 notation can be understood
17
+as a linear combination of powers of 10:
18
+
19
+- The rightmost digit gets multiplied by 10^0 = 1
20
+- The next number gets multiplied by 10^1 = 10
21
+- ...
22
+- The *n*th number gets multiplied by 10^*(n-1)*.
23
+- All these values are summed.
24
+
25
+So: `23 => 2*10^1 + 3*10^0 => 2*10 + 3*1 = 23 base 10`
26
+
27
+Binary is similar, but uses powers of 2 rather than powers of 10.
28
+
29
+So: `101 => 1*2^2 + 0*2^1 + 1*2^0 => 1*4 + 0*2 + 1*1 => 4 + 1 => 5 base 10`.
30
+
31
+
32
+To run the tests:
33
+
34
+```sh
35
+$ gradle test
36
+```
37
+
38
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
39
+
40
+
41
+## Source
42
+
43
+All of Computer Science [http://www.wolframalpha.com/input/?i=binary&a=*C.binary-_*MathWorld-](http://www.wolframalpha.com/input/?i=binary&a=*C.binary-_*MathWorld-)
44
+
45
+## Submitting Incomplete Solutions
46
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
47
+

+ 30
- 0
exercises/bob/README.md Просмотреть файл

@@ -0,0 +1,30 @@
1
+# Bob
2
+
3
+Bob is a lackadaisical teenager. In conversation, his responses are very limited.
4
+
5
+Bob answers 'Sure.' if you ask him a question.
6
+
7
+He answers 'Whoa, chill out!' if you yell at him.
8
+
9
+He says 'Fine. Be that way!' if you address him without actually saying
10
+anything.
11
+
12
+He answers 'Whatever.' to anything else.
13
+
14
+
15
+To run the tests:
16
+
17
+```sh
18
+$ gradle test
19
+```
20
+
21
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
22
+
23
+
24
+## Source
25
+
26
+Inspired by the 'Deaf Grandma' exercise in Chris Pine's Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=06](http://pine.fm/LearnToProgram/?Chapter=06)
27
+
28
+## Submitting Incomplete Solutions
29
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
30
+

+ 86
- 0
exercises/book-store/README.md Просмотреть файл

@@ -0,0 +1,86 @@
1
+# Book Store
2
+
3
+To try and encourage more sales of different books from a popular 5 book
4
+series, a bookshop has decided to offer discounts on multiple book purchases.
5
+
6
+One copy of any of the five books costs $8. 
7
+
8
+If, however, you buy two different books, you get a 5%
9
+discount on those two books.
10
+
11
+If you buy 3 different books, you get a 10% discount. 
12
+
13
+If you buy 4 different books, you get a 20% discount.
14
+
15
+If you buy all 5, you get a 25% discount. 
16
+
17
+Note: that if you buy four books, of which 3 are
18
+different titles, you get a 10% discount on the 3 that
19
+form part of a set, but the fourth book still costs $8. 
20
+
21
+Your mission is to write a piece of code to calculate the
22
+price of any conceivable shopping basket (containing only
23
+books of the same series), giving as big a discount as
24
+possible.
25
+
26
+For example, how much does this basket of books cost?
27
+
28
+- 2 copies of the first book
29
+- 2 copies of the second book
30
+- 2 copies of the third book
31
+- 1 copy of the fourth book
32
+- 1 copy of the fifth book
33
+ 
34
+One way of grouping these 8 books is:
35
+
36
+- 1 group of 5 --> 25% discount (1st,2nd,3rd,4th,5th)
37
+- +1 group of 3 --> 10% discount (1st,2nd,3rd)
38
+
39
+This would give a total of:
40
+
41
+- 5 books at a 25% discount
42
+- +3 books at a 10% discount
43
+
44
+Resulting in:
45
+
46
+- 5 x (8 - 2.00) == 5 x 6.00 == $30.00
47
+- +3 x (8 - 0.80) == 3 x 7.20 == $21.60
48
+
49
+For a total of $51.60
50
+
51
+However, a different way to group these 8 books is:
52
+
53
+- 1 group of 4 books --> 20% discount  (1st,2nd,3rd,4th)
54
+- +1 group of 4 books --> 20% discount  (1st,2nd,3rd,5th)
55
+
56
+This would give a total of:
57
+
58
+- 4 books at a 20% discount
59
+- +4 books at a 20% discount
60
+
61
+Resulting in:
62
+
63
+- 4 x (8 - 1.60) == 4 x 6.40 == $25.60
64
+- +4 x (8 - 1.60) == 4 x 6.40 == $25.60
65
+
66
+For a total of $51.20
67
+
68
+And $51.20 is the price with the biggest discount.
69
+
70
+
71
+To run the tests:
72
+
73
+```sh
74
+$ gradle test
75
+```
76
+
77
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
78
+
79
+
80
+## Source
81
+
82
+Inspired by the harry potter kata from Cyber-Dojo. [http://cyber-dojo.org](http://cyber-dojo.org)
83
+
84
+## Submitting Incomplete Solutions
85
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
86
+

+ 65
- 0
exercises/bowling/README.md Просмотреть файл

@@ -0,0 +1,65 @@
1
+# Bowling
2
+
3
+Score a bowling game.
4
+
5
+Bowling is game where players roll a heavy ball to knock down pins
6
+arranged in a triangle. Write code to keep track of the score
7
+of a game of bowling.
8
+
9
+## Scoring Bowling
10
+
11
+The game consists of 10 frames. A frame is composed of one or two ball throws with 10 pins standing at frame initialization. There are three cases for the tabulation of a frame.
12
+
13
+* An open frame is where a score of less than 10 is recorded for the frame. In this case the score for the frame is the number of pins knocked down.
14
+
15
+* A spare is where all ten pins are knocked down after the second throw. The total value of a spare is 10 plus the number of pins knocked down in their next throw.
16
+
17
+* A strike is where all ten pins are knocked down after the first throw. The total value of a strike is 10 plus the number of pins knocked down in their next two throws. If a strike is immediately followed by a second strike, then we can not total the value of first strike until they throw the ball one more time.
18
+
19
+Here is a three frame example:
20
+
21
+| Frame 1         | Frame 2       | Frame 3                |
22
+| :-------------: |:-------------:| :---------------------:|
23
+| X (strike)      | 5/ (spare)    | 9 0 (open frame)       |
24
+
25
+Frame 1 is (10 + 5 + 5) = 20
26
+
27
+Frame 2 is (5 + 5 + 9) = 19
28
+
29
+Frame 3 is (9 + 0) = 9
30
+
31
+This means the current running total is 48.
32
+
33
+The tenth frame in the game is a special case. If someone throws a strike or a spare then they get a fill ball. Fill balls exist to calculate the total of the 10th frame. Scoring a strike or spare on the fill ball does not give the player more fill balls. The total value of the 10th frame is the total number of pins knocked down.
34
+
35
+For a tenth frame of X1/ (strike and a spare), the total value is 20.
36
+
37
+For a tenth frame of XXX (three strikes), the total value is 30.
38
+
39
+## Requirements
40
+
41
+Write code to keep track of the score of a game of bowling. It should
42
+support two operations:
43
+
44
+* `roll(pins : int)` is called each time the player rolls a ball.  The
45
+  argument is the number of pins knocked down.
46
+* `score() : int` is called only at the very end of the game.  It
47
+  returns the total score for that game.
48
+
49
+
50
+To run the tests:
51
+
52
+```sh
53
+$ gradle test
54
+```
55
+
56
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
57
+
58
+
59
+## Source
60
+
61
+The Bowling Game Kata at but UncleBob [http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata](http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata)
62
+
63
+## Submitting Incomplete Solutions
64
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
65
+

+ 22
- 0
exercises/bracket-push/README.md Просмотреть файл

@@ -0,0 +1,22 @@
1
+# Bracket Push
2
+
3
+Given a string containing brackets `[]`, braces `{}` and parentheses `()`,
4
+verify that all the pairs are matched and nested correctly.
5
+
6
+
7
+To run the tests:
8
+
9
+```sh
10
+$ gradle test
11
+```
12
+
13
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
14
+
15
+
16
+## Source
17
+
18
+Ginna Baker
19
+
20
+## Submitting Incomplete Solutions
21
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
22
+

+ 35
- 0
exercises/change/README.md Просмотреть файл

@@ -0,0 +1,35 @@
1
+# Change
2
+
3
+Correctly determine the fewest number of coins to be given to a customer such
4
+that the sum of the coins' value would equal the correct amount of change.
5
+
6
+## For example
7
+
8
+- An input of 15 with [1, 5, 10, 25, 100] should return one nickel (5)
9
+  and one dime (10) or [0, 1, 1, 0, 0]
10
+- An input of 40 with [1, 5, 10, 25, 100] should return one nickel (5)
11
+  and one dime (10) and one quarter (25) or [0, 1, 1, 1, 0]
12
+
13
+## Edge cases
14
+
15
+- Does your algorithm work for any given set of coins?
16
+- Can you ask for negative change?
17
+- Can you ask for a change value smaller than the smallest coin value?
18
+
19
+
20
+To run the tests:
21
+
22
+```sh
23
+$ gradle test
24
+```
25
+
26
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
27
+
28
+
29
+## Source
30
+
31
+Software Craftsmanship - Kata-logue [http://craftsmanship.sv.cmu.edu/exercises/coin-change-kata](http://craftsmanship.sv.cmu.edu/exercises/coin-change-kata)
32
+
33
+## Submitting Incomplete Solutions
34
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
35
+

+ 62
- 0
exercises/circular-buffer/README.md Просмотреть файл

@@ -0,0 +1,62 @@
1
+# Circular Buffer
2
+
3
+A circular buffer, cyclic buffer or ring buffer is a data structure that
4
+uses a single, fixed-size buffer as if it were connected end-to-end.
5
+
6
+A circular buffer first starts empty and of some predefined length. For
7
+example, this is a 7-element buffer:
8
+
9
+    [ ][ ][ ][ ][ ][ ][ ]
10
+
11
+Assume that a 1 is written into the middle of the buffer (exact starting
12
+location does not matter in a circular buffer):
13
+
14
+    [ ][ ][ ][1][ ][ ][ ]
15
+
16
+Then assume that two more elements are added — 2 & 3 — which get
17
+appended after the 1:
18
+
19
+    [ ][ ][ ][1][2][3][ ]
20
+
21
+If two elements are then removed from the buffer, the oldest values
22
+inside the buffer are removed. The two elements removed, in this case,
23
+are 1 & 2, leaving the buffer with just a 3:
24
+
25
+    [ ][ ][ ][ ][ ][3][ ]
26
+
27
+If the buffer has 7 elements then it is completely full:
28
+
29
+    [6][7][8][9][3][4][5]
30
+
31
+When the buffer is full an error will be raised, alerting the client
32
+that further writes are blocked until a slot becomes free.
33
+
34
+The client can opt to overwrite the oldest data with a forced write. In
35
+this case, two more elements — A & B — are added and they overwrite the
36
+3 & 4:
37
+
38
+    [6][7][8][9][A][B][5]
39
+
40
+Finally, if two elements are now removed then what would be returned is
41
+not 3 & 4 but 5 & 6 because A & B overwrote the 3 & the 4 yielding the
42
+buffer with:
43
+
44
+    [ ][7][8][9][A][B][ ]
45
+
46
+
47
+To run the tests:
48
+
49
+```sh
50
+$ gradle test
51
+```
52
+
53
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
54
+
55
+
56
+## Source
57
+
58
+Wikipedia [http://en.wikipedia.org/wiki/Circular_buffer](http://en.wikipedia.org/wiki/Circular_buffer)
59
+
60
+## Submitting Incomplete Solutions
61
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
62
+

+ 30
- 0
exercises/clock/README.md Просмотреть файл

@@ -0,0 +1,30 @@
1
+# Clock
2
+
3
+Implement a clock that handles times without dates.
4
+
5
+You should be able to add and subtract minutes to it.
6
+
7
+Two clocks that represent the same time should be equal to each other.
8
+
9
+In order to satisfy the requirement that two clocks are considered equal just when they are set to the same time, you will need to override the [`equals`](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals(java.lang.Object)) and [`hashcode`](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode) methods in your `Clock` class.
10
+ 
11
+For more information on how to override these methods, see [this JavaWorld article](https://web.archive.org/web/20170528222153/http://www.javaworld.com/article/2072762/java-app-dev/object-equality.html).
12
+
13
+
14
+
15
+To run the tests:
16
+
17
+```sh
18
+$ gradle test
19
+```
20
+
21
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
22
+
23
+
24
+## Source
25
+
26
+Pairing session with Erin Drummond [https://twitter.com/ebdrummond](https://twitter.com/ebdrummond)
27
+
28
+## Submitting Incomplete Solutions
29
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
30
+

+ 45
- 0
exercises/collatz-conjecture/README.md Просмотреть файл

@@ -0,0 +1,45 @@
1
+# Collatz Conjecture
2
+
3
+The Collatz Conjecture or 3x+1 problem can be summarized as follows:
4
+
5
+Take any positive integer n. If n is even, divide n by 2 to get n / 2. If n is
6
+odd, multiply n by 3 and add 1 to get 3n + 1. Repeat the process indefinitely.
7
+The conjecture states that no matter which number you start with, you will
8
+always reach 1 eventually.
9
+
10
+Given a number n, return the number of steps required to reach 1.
11
+
12
+## Examples
13
+Starting with n = 12, the steps would be as follows:
14
+
15
+0. 12
16
+1. 6
17
+2. 3
18
+3. 10
19
+4. 5
20
+5. 16
21
+6. 8
22
+7. 4
23
+8. 2
24
+9. 1
25
+
26
+Resulting in 9 steps. So for input n = 12, the return value would be 9.
27
+
28
+
29
+
30
+To run the tests:
31
+
32
+```sh
33
+$ gradle test
34
+```
35
+
36
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
37
+
38
+
39
+## Source
40
+
41
+An unsolved problem in mathematics named after mathematician Lothar Collatz [https://en.wikipedia.org/wiki/3x_%2B_1_problem](https://en.wikipedia.org/wiki/3x_%2B_1_problem)
42
+
43
+## Submitting Incomplete Solutions
44
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
45
+

+ 23
- 0
exercises/complex-numbers/README.md Просмотреть файл

@@ -0,0 +1,23 @@
1
+# Complex Numbers
2
+
3
+A complex number is a number in the form `a + b * i` where `a` and `b` are real and `i` satisfies `i^2 = -1`.
4
+
5
+Assume the programming language you are using does not have an implementation of complex numbers.
6
+
7
+
8
+To run the tests:
9
+
10
+```sh
11
+$ gradle test
12
+```
13
+
14
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
15
+
16
+
17
+## Source
18
+
19
+Wikipedia [https://en.wikipedia.org/wiki/Complex_number](https://en.wikipedia.org/wiki/Complex_number)
20
+
21
+## Submitting Incomplete Solutions
22
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
23
+

+ 86
- 0
exercises/crypto-square/README.md Просмотреть файл

@@ -0,0 +1,86 @@
1
+# Crypto Square
2
+
3
+Implement the classic method for composing secret messages called a square code.
4
+
5
+Given an English text, output the encoded version of that text.
6
+
7
+First, the input is normalized: the spaces and punctuation are removed
8
+from the English text and the message is downcased.
9
+
10
+Then, the normalized characters are broken into rows.  These rows can be
11
+regarded as forming a rectangle when printed with intervening newlines.
12
+
13
+For example, the sentence
14
+
15
+> If man was meant to stay on the ground, god would have given us roots.
16
+
17
+is normalized to:
18
+
19
+> ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots
20
+
21
+The plaintext should be organized in to a rectangle.  The size of the
22
+rectangle (`r x c`) should be decided by the length of the message,
23
+such that `c >= r` and `c - r <= 1`, where `c` is the number of columns
24
+and `r` is the number of rows.
25
+
26
+Our normalized text is 54 characters long, dictating a rectangle with
27
+`c = 8` and `r = 7`:
28
+
29
+```plain
30
+ifmanwas
31
+meanttos
32
+tayonthe
33
+groundgo
34
+dwouldha
35
+vegivenu
36
+sroots
37
+```
38
+
39
+The coded message is obtained by reading down the columns going left to
40
+right.
41
+
42
+The message above is coded as:
43
+
44
+```plain
45
+imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
46
+```
47
+
48
+Output the encoded text in chunks.  Phrases that fill perfect squares
49
+`(r X r)` should be output in `r`-length chunks separated by spaces.
50
+Imperfect squares will have `n` empty spaces.  Those spaces should be distributed evenly across the last `n` rows.
51
+
52
+```plain
53
+imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau
54
+```
55
+
56
+Notice that were we to stack these, we could visually decode the
57
+cyphertext back in to the original message:
58
+
59
+```plain
60
+imtgdvs
61
+fearwer
62
+mayoogo
63
+anouuio
64
+ntnnlvt
65
+wttddes
66
+aohghn
67
+sseoau
68
+```
69
+
70
+
71
+To run the tests:
72
+
73
+```sh
74
+$ gradle test
75
+```
76
+
77
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
78
+
79
+
80
+## Source
81
+
82
+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)
83
+
84
+## Submitting Incomplete Solutions
85
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
86
+

+ 23
- 0
exercises/custom-set/README.md Просмотреть файл

@@ -0,0 +1,23 @@
1
+# Custom Set
2
+
3
+Create a custom set type.
4
+
5
+Sometimes it is necessary to define a custom data structure of some
6
+type, like a set. In this exercise you will define your own set. How it
7
+works internally doesn't matter, as long as it behaves like a set of
8
+unique elements.
9
+
10
+
11
+To run the tests:
12
+
13
+```sh
14
+$ gradle test
15
+```
16
+
17
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
18
+
19
+
20
+
21
+## Submitting Incomplete Solutions
22
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
23
+

+ 71
- 0
exercises/diamond/README.md Просмотреть файл

@@ -0,0 +1,71 @@
1
+# Diamond
2
+
3
+The diamond kata takes as its input a letter, and outputs it in a diamond 
4
+shape. Given a letter, it prints a diamond starting with 'A', with the 
5
+supplied letter at the widest point.
6
+
7
+## Requirements
8
+
9
+* The first row contains one 'A'.
10
+* The last row contains one 'A'.
11
+* All rows, except the first and last, have exactly two identical letters.
12
+* All rows have as many trailing spaces as leading spaces. (This might be 0).
13
+* The diamond is horizontally symmetric.
14
+* The diamond is vertically symmetric.
15
+* The diamond has a square shape (width equals height).
16
+* The letters form a diamond shape.
17
+* The top half has the letters in ascending order.
18
+* The bottom half has the letters in descending order. 
19
+* The four corners (containing the spaces) are triangles.
20
+
21
+## Examples
22
+
23
+In the following examples, spaces are indicated by `·` characters.
24
+
25
+Diamond for letter 'A':
26
+
27
+```plain
28
+A
29
+```
30
+
31
+Diamond for letter 'C':
32
+
33
+```plain
34
+··A··
35
+·B·B·
36
+C···C
37
+·B·B·
38
+··A··
39
+```
40
+
41
+Diamond for letter 'E':
42
+
43
+```plain
44
+····A····
45
+···B·B···
46
+··C···C··
47
+·D·····D·
48
+E·······E
49
+·D·····D·
50
+··C···C··
51
+···B·B···
52
+····A····
53
+```
54
+
55
+
56
+To run the tests:
57
+
58
+```sh
59
+$ gradle test
60
+```
61
+
62
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
63
+
64
+
65
+## Source
66
+
67
+Seb Rose [http://claysnow.co.uk/recycling-tests-in-tdd/](http://claysnow.co.uk/recycling-tests-in-tdd/)
68
+
69
+## Submitting Incomplete Solutions
70
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
71
+

+ 31
- 0
exercises/difference-of-squares/README.md Просмотреть файл

@@ -0,0 +1,31 @@
1
+# Difference Of Squares
2
+
3
+Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.
4
+
5
+The square of the sum of the first ten natural numbers is
6
+(1 + 2 + ... + 10)² = 55² = 3025.
7
+
8
+The sum of the squares of the first ten natural numbers is
9
+1² + 2² + ... + 10² = 385.
10
+
11
+Hence the difference between the square of the sum of the first
12
+ten natural numbers and the sum of the squares of the first ten
13
+natural numbers is 3025 - 385 = 2640.
14
+
15
+
16
+To run the tests:
17
+
18
+```sh
19
+$ gradle test
20
+```
21
+
22
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
23
+
24
+
25
+## Source
26
+
27
+Problem 6 at Project Euler [http://projecteuler.net/problem=6](http://projecteuler.net/problem=6)
28
+
29
+## Submitting Incomplete Solutions
30
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
31
+

+ 63
- 0
exercises/etl/README.md Просмотреть файл

@@ -0,0 +1,63 @@
1
+# Etl
2
+
3
+We are going to do the `Transform` step of an Extract-Transform-Load.
4
+
5
+### ETL
6
+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
7
+we're going to migrate this."
8
+
9
+(Typically, this is followed by, "We're only going to need to run this
10
+once." That's then typically followed by much forehead slapping and
11
+moaning about how stupid we could possibly be.)
12
+
13
+### The goal
14
+We're going to extract some scrabble scores from a legacy system.
15
+
16
+The old system stored a list of letters per score:
17
+
18
+- 1 point: "A", "E", "I", "O", "U", "L", "N", "R", "S", "T",
19
+- 2 points: "D", "G",
20
+- 3 points: "B", "C", "M", "P",
21
+- 4 points: "F", "H", "V", "W", "Y",
22
+- 5 points: "K",
23
+- 8 points: "J", "X",
24
+- 10 points: "Q", "Z",
25
+
26
+The shiny new scrabble system instead stores the score per letter, which
27
+makes it much faster and easier to calculate the score for a word. It
28
+also stores the letters in lower-case regardless of the case of the
29
+input letters:
30
+
31
+- "a" is worth 1 point.
32
+- "b" is worth 3 points.
33
+- "c" is worth 3 points.
34
+- "d" is worth 2 points.
35
+- Etc.
36
+
37
+Your mission, should you choose to accept it, is to transform the legacy data
38
+format to the shiny new format.
39
+
40
+### Notes
41
+
42
+A final note about scoring, Scrabble is played around the world in a
43
+variety of languages, each with its own unique scoring table. For
44
+example, an "E" is scored at 2 in the Māori-language version of the
45
+game while being scored at 4 in the Hawaiian-language version.
46
+
47
+
48
+To run the tests:
49
+
50
+```sh
51
+$ gradle test
52
+```
53
+
54
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
55
+
56
+
57
+## Source
58
+
59
+The Jumpstart Lab team [http://jumpstartlab.com](http://jumpstartlab.com)
60
+
61
+## Submitting Incomplete Solutions
62
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
63
+

+ 30
- 0
exercises/flatten-array/README.md Просмотреть файл

@@ -0,0 +1,30 @@
1
+# Flatten Array
2
+
3
+Take a nested list and return a single flattened list with all values except nil/null.
4
+
5
+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.
6
+ 
7
+For Example
8
+
9
+input: [1,[2,3,null,4],[null],5]
10
+
11
+output: [1,2,3,4,5]
12
+
13
+
14
+
15
+To run the tests:
16
+
17
+```sh
18
+$ gradle test
19
+```
20
+
21
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
22
+
23
+
24
+## Source
25
+
26
+Interview Question [https://reference.wolfram.com/language/ref/Flatten.html](https://reference.wolfram.com/language/ref/Flatten.html)
27
+
28
+## Submitting Incomplete Solutions
29
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
30
+

+ 82
- 0
exercises/food-chain/README.md Просмотреть файл

@@ -0,0 +1,82 @@
1
+# Food Chain
2
+
3
+Generate the lyrics of the song 'I Know an Old Lady Who Swallowed a Fly'.
4
+
5
+While you could copy/paste the lyrics,
6
+or read them from a file, this problem is much more
7
+interesting if you approach it algorithmically.
8
+
9
+This is a [cumulative song](http://en.wikipedia.org/wiki/Cumulative_song) of unknown origin.
10
+
11
+This is one of many common variants.
12
+
13
+```plain
14
+I know an old lady who swallowed a fly.
15
+I don't know why she swallowed the fly. Perhaps she'll die.
16
+
17
+I know an old lady who swallowed a spider.
18
+It wriggled and jiggled and tickled inside her.
19
+She swallowed the spider to catch the fly.
20
+I don't know why she swallowed the fly. Perhaps she'll die.
21
+
22
+I know an old lady who swallowed a bird.
23
+How absurd to swallow a bird!
24
+She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
25
+She swallowed the spider to catch the fly.
26
+I don't know why she swallowed the fly. Perhaps she'll die.
27
+
28
+I know an old lady who swallowed a cat.
29
+Imagine that, to swallow a cat!
30
+She swallowed the cat to catch the bird.
31
+She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
32
+She swallowed the spider to catch the fly.
33
+I don't know why she swallowed the fly. Perhaps she'll die.
34
+
35
+I know an old lady who swallowed a dog.
36
+What a hog, to swallow a dog!
37
+She swallowed the dog to catch the cat.
38
+She swallowed the cat to catch the bird.
39
+She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
40
+She swallowed the spider to catch the fly.
41
+I don't know why she swallowed the fly. Perhaps she'll die.
42
+
43
+I know an old lady who swallowed a goat.
44
+Just opened her throat and swallowed a goat!
45
+She swallowed the goat to catch the dog.
46
+She swallowed the dog to catch the cat.
47
+She swallowed the cat to catch the bird.
48
+She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
49
+She swallowed the spider to catch the fly.
50
+I don't know why she swallowed the fly. Perhaps she'll die.
51
+
52
+I know an old lady who swallowed a cow.
53
+I don't know how she swallowed a cow!
54
+She swallowed the cow to catch the goat.
55
+She swallowed the goat to catch the dog.
56
+She swallowed the dog to catch the cat.
57
+She swallowed the cat to catch the bird.
58
+She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
59
+She swallowed the spider to catch the fly.
60
+I don't know why she swallowed the fly. Perhaps she'll die.
61
+
62
+I know an old lady who swallowed a horse.
63
+She's dead, of course!
64
+```
65
+
66
+
67
+To run the tests:
68
+
69
+```sh
70
+$ gradle test
71
+```
72
+
73
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
74
+
75
+
76
+## Source
77
+
78
+Wikipedia [http://en.wikipedia.org/wiki/There_Was_an_Old_Lady_Who_Swallowed_a_Fly](http://en.wikipedia.org/wiki/There_Was_an_Old_Lady_Who_Swallowed_a_Fly)
79
+
80
+## Submitting Incomplete Solutions
81
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
82
+

+ 23
- 0
exercises/gigasecond/README.md Просмотреть файл

@@ -0,0 +1,23 @@
1
+# Gigasecond
2
+
3
+Calculate the moment when someone has lived for 10^9 seconds.
4
+
5
+A gigasecond is 10^9 (1,000,000,000) seconds.
6
+
7
+
8
+To run the tests:
9
+
10
+```sh
11
+$ gradle test
12
+```
13
+
14
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
15
+
16
+
17
+## Source
18
+
19
+Chapter 9 in Chris Pine's online Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=09](http://pine.fm/LearnToProgram/?Chapter=09)
20
+
21
+## Submitting Incomplete Solutions
22
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
23
+

+ 54
- 0
exercises/grade-school/README.md Просмотреть файл

@@ -0,0 +1,54 @@
1
+# Grade School
2
+
3
+Given students' names along with the grade that they are in, create a roster
4
+for the school.
5
+
6
+In the end, you should be able to:
7
+
8
+- Add a student's name to the roster for a grade
9
+  - "Add Jim to grade 2."
10
+  - "OK."
11
+- Get a list of all students enrolled in a grade
12
+  - "Which students are in grade 2?"
13
+  - "We've only got Jim just now."
14
+- Get a sorted list of all students in all grades.  Grades should sort
15
+  as 1, 2, 3, etc., and students within a grade should be sorted
16
+  alphabetically by name.
17
+  - "Who all is enrolled in school right now?"
18
+  - "Grade 1: Anna, Barb, and Charlie. Grade 2: Alex, Peter, and Zoe.
19
+    Grade 3…"
20
+
21
+Note that all our students only have one name.  (It's a small town, what
22
+do you want?)
23
+
24
+
25
+## For bonus points
26
+
27
+Did you get the tests passing and the code clean? If you want to, these
28
+are some additional things you could try:
29
+
30
+- If you're working in a language with mutable data structures and your
31
+  implementation allows outside code to mutate the school's internal DB
32
+  directly, see if you can prevent this. Feel free to introduce additional
33
+  tests.
34
+
35
+Then please share your thoughts in a comment on the submission. Did this
36
+experiment make the code better? Worse? Did you learn anything from it?
37
+
38
+
39
+To run the tests:
40
+
41
+```sh
42
+$ gradle test
43
+```
44
+
45
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
46
+
47
+
48
+## Source
49
+
50
+A pairing session with Phil Battos at gSchool [http://gschool.it](http://gschool.it)
51
+
52
+## Submitting Incomplete Solutions
53
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
54
+

+ 68
- 0
exercises/hamming/README.md Просмотреть файл

@@ -0,0 +1,68 @@
1
+# Hamming
2
+
3
+Calculate the Hamming difference between two DNA strands.
4
+
5
+A mutation is simply a mistake that occurs during the creation or
6
+copying of a nucleic acid, in particular DNA. Because nucleic acids are
7
+vital to cellular functions, mutations tend to cause a ripple effect
8
+throughout the cell. Although mutations are technically mistakes, a very
9
+rare mutation may equip the cell with a beneficial attribute. In fact,
10
+the macro effects of evolution are attributable by the accumulated
11
+result of beneficial microscopic mutations over many generations.
12
+
13
+The simplest and most common type of nucleic acid mutation is a point
14
+mutation, which replaces one base with another at a single nucleotide.
15
+
16
+By counting the number of differences between two homologous DNA strands
17
+taken from different genomes with a common ancestor, we get a measure of
18
+the minimum number of point mutations that could have occurred on the
19
+evolutionary path between the two strands.
20
+
21
+This is called the 'Hamming distance'.
22
+
23
+It is found by comparing two DNA strands and counting how many of the
24
+nucleotides are different from their equivalent in the other string.
25
+
26
+    GAGCCTACTAACGGGAT
27
+    CATCGTAATGACGGCCT
28
+    ^ ^ ^  ^ ^    ^^
29
+
30
+The Hamming distance between these two DNA strands is 7.
31
+
32
+# Implementation notes
33
+
34
+The Hamming distance is only defined for sequences of equal length. This means
35
+that based on the definition, each language could deal with getting sequences
36
+of equal length differently.
37
+
38
+## Hints
39
+
40
+This is the first exercise with tests that require you to throw an
41
+[`Exception`](https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html). `Exception`s are typically thrown to
42
+indicate that a program has encountered an unexpected input or state.
43
+
44
+We use JUnit's [`ExpectedException`](http://junit.org/junit4/javadoc/4.12/org/junit/rules/ExpectedException.html)
45
+[rule](https://github.com/junit-team/junit4/wiki/rules) throughout the track to verify that the exceptions you throw
46
+are:
47
+
48
+1. instances of a specified Java type;
49
+2. (optionally) initialized with a specified message.
50
+
51
+
52
+
53
+To run the tests:
54
+
55
+```sh
56
+$ gradle test
57
+```
58
+
59
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
60
+
61
+
62
+## Source
63
+
64
+The Calculating Point Mutations problem at Rosalind [http://rosalind.info/problems/hamm/](http://rosalind.info/problems/hamm/)
65
+
66
+## Submitting Incomplete Solutions
67
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
68
+

+ 39
- 0
exercises/hello-world/README.md Просмотреть файл

@@ -0,0 +1,39 @@
1
+# Hello World
2
+
3
+The classical introductory exercise. Just say "Hello, World!".
4
+
5
+["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is
6
+the traditional first program for beginning programming in a new language
7
+or environment.
8
+
9
+The objectives are simple:
10
+
11
+- Write a function that returns the string "Hello, World!".
12
+- Run the test suite and make sure that it succeeds.
13
+- Submit your solution and check it at the website.
14
+
15
+If everything goes well, you will be ready to fetch your first real exercise.
16
+
17
+Since this is your first Java exercise, we've included a detailed TUTORIAL.md
18
+file that guides you through your solution. Check it out for tips and
19
+assistance!
20
+
21
+
22
+
23
+
24
+To run the tests:
25
+
26
+```sh
27
+$ gradle test
28
+```
29
+
30
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
31
+
32
+
33
+## Source
34
+
35
+This is an exercise to introduce users to using Exercism [http://en.wikipedia.org/wiki/%22Hello,_world!%22_program](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program)
36
+
37
+## Submitting Incomplete Solutions
38
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
39
+

+ 26
- 0
exercises/hexadecimal/README.md Просмотреть файл

@@ -0,0 +1,26 @@
1
+# Hexadecimal
2
+
3
+Convert a hexadecimal number, represented as a string (e.g. "10af8c"), to its decimal equivalent using first principles (i.e. no, you may not use built-in or external libraries to accomplish the conversion).
4
+
5
+On the web we use hexadecimal to represent colors, e.g. green: 008000,
6
+teal: 008080, navy: 000080).
7
+
8
+The program should handle invalid hexadecimal strings.
9
+
10
+
11
+To run the tests:
12
+
13
+```sh
14
+$ gradle test
15
+```
16
+
17
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
18
+
19
+
20
+## Source
21
+
22
+All of Computer Science [http://www.wolframalpha.com/examples/NumberBases.html](http://www.wolframalpha.com/examples/NumberBases.html)
23
+
24
+## Submitting Incomplete Solutions
25
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
26
+

+ 42
- 0
exercises/isogram/README.md Просмотреть файл

@@ -0,0 +1,42 @@
1
+# Isogram
2
+
3
+Determine if a word or phrase is an isogram.
4
+
5
+An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter.
6
+
7
+Examples of isograms:
8
+
9
+- lumberjacks
10
+- background
11
+- downstream
12
+
13
+The word *isograms*, however, is not an isogram, because the s repeats.
14
+
15
+If you find that `testWorksWithGermanLetters` fails even though you think you've implemented it correctly,
16
+this could be because of the [JVM encoding](https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_61/rzaha/international.htm). 
17
+Try setting the `JAVA_TOOL_OPTIONS` environment variable to `-Dfile.encoding=UTF8` to fix this.
18
+- To set an environment variable on Windows:
19
+    1. Go to Computer -> Properties -> Advanced System Settings
20
+    2. Add a new environment variable
21
+
22
+- [To set an environment variable on a mac](http://blog.lidalia.org.uk/2011/04/setting-default-java-file-encoding-to.html)
23
+
24
+- [To set an environment variable on linux](https://unix.stackexchange.com/questions/151733/where-can-i-set-global-java-options)
25
+
26
+
27
+To run the tests:
28
+
29
+```sh
30
+$ gradle test
31
+```
32
+
33
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
34
+
35
+
36
+## Source
37
+
38
+Wikipedia [https://en.wikipedia.org/wiki/Isogram](https://en.wikipedia.org/wiki/Isogram)
39
+
40
+## Submitting Incomplete Solutions
41
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
42
+

+ 78
- 0
exercises/kindergarten-garden/README.md Просмотреть файл

@@ -0,0 +1,78 @@
1
+# Kindergarten Garden
2
+
3
+Given a diagram, determine which plants each child in the kindergarten class is
4
+responsible for.
5
+
6
+The kindergarten class is learning about growing plants. The teachers
7
+thought it would be a good idea to give them actual seeds, plant them in
8
+actual dirt, and grow actual plants.
9
+
10
+They've chosen to grow grass, clover, radishes, and violets.
11
+
12
+To this end, they've put little styrofoam cups along the window sills,
13
+and planted one type of plant in each cup, choosing randomly from the
14
+available types of seeds.
15
+
16
+```plain
17
+[window][window][window]
18
+........................ # each dot represents a styrofoam cup
19
+........................
20
+```
21
+
22
+There are 12 children in the class:
23
+
24
+- Alice, Bob, Charlie, David,
25
+- Eve, Fred, Ginny, Harriet,
26
+- Ileana, Joseph, Kincaid, and Larry.
27
+
28
+Each child gets 4 cups, two on each row. The children are assigned to
29
+cups in alphabetical order.
30
+
31
+The following diagram represents Alice's plants:
32
+
33
+```plain
34
+[window][window][window]
35
+VR......................
36
+RG......................
37
+```
38
+
39
+So in the row nearest the window, she has a violet and a radish; in the
40
+row behind that, she has a radish and some grass.
41
+
42
+Your program will be given the plants from left-to-right starting with
43
+the row nearest the windows. From this, it should be able to determine
44
+which plants belong to which students.
45
+
46
+For example, if it's told that the garden looks like so:
47
+
48
+```plain
49
+[window][window][window]
50
+VRCGVVRVCGGCCGVRGCVCGCGV
51
+VRCCCGCRRGVCGCRVVCVGCGCV
52
+```
53
+
54
+Then if asked for Alice's plants, it should provide:
55
+
56
+- Violets, radishes, violets, radishes
57
+
58
+While asking for Bob's plants would yield:
59
+
60
+- Clover, grass, clover, clover
61
+
62
+
63
+To run the tests:
64
+
65
+```sh
66
+$ gradle test
67
+```
68
+
69
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
70
+
71
+
72
+## Source
73
+
74
+Random musings during airplane trip. [http://jumpstartlab.com](http://jumpstartlab.com)
75
+
76
+## Submitting Incomplete Solutions
77
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
78
+

+ 32
- 0
exercises/largest-series-product/README.md Просмотреть файл

@@ -0,0 +1,32 @@
1
+# Largest Series Product
2
+
3
+Given a string of digits, calculate the largest product for a contiguous
4
+substring of digits of length n.
5
+
6
+For example, for the input `'1027839564'`, the largest product for a
7
+series of 3 digits is 270 (9 * 5 * 6), and the largest product for a
8
+series of 5 digits is 7560 (7 * 8 * 3 * 9 * 5).
9
+
10
+Note that these series are only required to occupy *adjacent positions*
11
+in the input; the digits need not be *numerically consecutive*.
12
+
13
+For the input `'73167176531330624919225119674426574742355349194934'`,
14
+the largest product for a series of 6 digits is 23520.
15
+
16
+
17
+To run the tests:
18
+
19
+```sh
20
+$ gradle test
21
+```
22
+
23
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
24
+
25
+
26
+## Source
27
+
28
+A variation on Problem 8 at Project Euler [http://projecteuler.net/problem=8](http://projecteuler.net/problem=8)
29
+
30
+## Submitting Incomplete Solutions
31
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
32
+

+ 46
- 0
exercises/linked-list/README.md Просмотреть файл

@@ -0,0 +1,46 @@
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
+
31
+To run the tests:
32
+
33
+```sh
34
+$ gradle test
35
+```
36
+
37
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
38
+
39
+
40
+## Source
41
+
42
+Classic computer science topic
43
+
44
+## Submitting Incomplete Solutions
45
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
46
+

+ 27
- 0
exercises/list-ops/README.md Просмотреть файл

@@ -0,0 +1,27 @@
1
+# List Ops
2
+
3
+Implement basic list operations.
4
+
5
+In functional languages list operations like `length`, `map`, and
6
+`reduce` are very common. Implement a series of basic list operations,
7
+without using existing functions.
8
+
9
+## Hints
10
+
11
+The `foldLeft` and `foldRight` methods are "fold" functions, which is a concept well-known in the functional programming world, but less so in the object-oriented one. See the Wikipedia page on folding for [general background](https://en.wikipedia.org/wiki/Fold_(higher-order_function)) and [signature/implementation hints](https://en.wikipedia.org/wiki/Fold_(higher-order_function)#Linear_folds).
12
+
13
+
14
+
15
+To run the tests:
16
+
17
+```sh
18
+$ gradle test
19
+```
20
+
21
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
22
+
23
+
24
+
25
+## Submitting Incomplete Solutions
26
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
27
+

+ 83
- 0
exercises/luhn/README.md Просмотреть файл

@@ -0,0 +1,83 @@
1
+# Luhn
2
+
3
+Given a number determine whether or not it is valid per the Luhn formula.
4
+
5
+The [Luhn algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) is
6
+a simple checksum formula used to validate a variety of identification
7
+numbers, such as credit card numbers and Canadian Social Insurance
8
+Numbers.
9
+
10
+The task is to check if a given string is valid.
11
+
12
+Validating a Number
13
+------
14
+
15
+Strings of length 1 or less are not valid. Spaces are allowed in the input,
16
+but they should be stripped before checking. All other non-digit characters
17
+are disallowed.
18
+
19
+## Example 1: valid credit card number
20
+
21
+```
22
+4539 1488 0343 6467
23
+```
24
+
25
+The first step of the Luhn algorithm is to double every second digit,
26
+starting from the right. We will be doubling
27
+
28
+```
29
+4_3_ 1_8_ 0_4_ 6_6_
30
+```
31
+
32
+If doubling the number results in a number greater than 9 then subtract 9
33
+from the product. The results of our doubling:
34
+
35
+```
36
+8569 2478 0383 3437
37
+```
38
+
39
+Then sum all of the digits:
40
+
41
+```
42
+8+5+6+9+2+4+7+8+0+3+8+3+3+4+3+7 = 80
43
+```
44
+
45
+If the sum is evenly divisible by 10, then the number is valid. This number is valid!
46
+
47
+## Example 2: invalid credit card number
48
+
49
+```
50
+8273 1232 7352 0569
51
+```
52
+
53
+Double the second digits, starting from the right
54
+
55
+```
56
+7253 2262 5312 0539
57
+```
58
+
59
+Sum the digits
60
+
61
+```
62
+7+2+5+3+2+2+6+2+5+3+1+2+0+5+3+9 = 57
63
+```
64
+
65
+57 is not evenly divisible by 10, so this number is not valid.
66
+
67
+
68
+To run the tests:
69
+
70
+```sh
71
+$ gradle test
72
+```
73
+
74
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
75
+
76
+
77
+## Source
78
+
79
+The Luhn Algorithm on Wikipedia [http://en.wikipedia.org/wiki/Luhn_algorithm](http://en.wikipedia.org/wiki/Luhn_algorithm)
80
+
81
+## Submitting Incomplete Solutions
82
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
83
+

+ 57
- 0
exercises/matrix/README.md Просмотреть файл

@@ -0,0 +1,57 @@
1
+# Matrix
2
+
3
+Given a string representing a matrix of numbers, return the rows and columns of
4
+that matrix.
5
+
6
+So given a string with embedded newlines like:
7
+
8
+> 9 8 7  
9
+> 5 3 2  
10
+> 6 6 7  
11
+
12
+representing this matrix:
13
+
14
+```plain
15
+    0  1  2
16
+  |---------
17
+0 | 9  8  7
18
+1 | 5  3  2
19
+2 | 6  6  7
20
+```
21
+
22
+your code should be able to spit out:
23
+
24
+- A list of the rows, reading each row left-to-right while moving
25
+  top-to-bottom across the rows,
26
+- A list of the columns, reading each column top-to-bottom while moving
27
+  from left-to-right.
28
+
29
+The rows for our example matrix:
30
+
31
+- 9, 8, 7
32
+- 5, 3, 2
33
+- 6, 6, 7
34
+
35
+And its columns:
36
+
37
+- 9, 5, 6
38
+- 8, 3, 6
39
+- 7, 2, 7
40
+
41
+
42
+To run the tests:
43
+
44
+```sh
45
+$ gradle test
46
+```
47
+
48
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
49
+
50
+
51
+## Source
52
+
53
+Warmup to the `saddle-points` warmup. [http://jumpstartlab.com](http://jumpstartlab.com)
54
+
55
+## Submitting Incomplete Solutions
56
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
57
+

+ 42
- 0
exercises/meetup/README.md Просмотреть файл

@@ -0,0 +1,42 @@
1
+# Meetup
2
+
3
+Calculate the date of meetups.
4
+
5
+Typically meetups happen on the same day of the week.  In this exercise, you will take
6
+a description of a meetup date, and return the actual meetup date.
7
+
8
+Examples of general descriptions are:
9
+
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
+
15
+Note that "Monteenth", "Tuesteenth", etc are all made up words. There
16
+was a meetup whose members realized that there are exactly 7 numbered days in a month that
17
+end in '-teenth'. Therefore, one is guaranteed that each day of the week
18
+(Monday, Tuesday, ...) will have exactly one date that is named with '-teenth'
19
+in every month.
20
+
21
+Given examples of a meetup dates, each containing a month, day, year, and descriptor 
22
+(first, second, teenth, etc), calculate the date of the actual meetup.
23
+For example, if given "First Monday of January 2017", the correct meetup date is 2017/1/2
24
+ 
25
+
26
+
27
+To run the tests:
28
+
29
+```sh
30
+$ gradle test
31
+```
32
+
33
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
34
+
35
+
36
+## Source
37
+
38
+Jeremy Hinegardner mentioned a Boulder meetup that happens on the Wednesteenth of every month [https://twitter.com/copiousfreetime](https://twitter.com/copiousfreetime)
39
+
40
+## Submitting Incomplete Solutions
41
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
42
+

+ 42
- 0
exercises/minesweeper/README.md Просмотреть файл

@@ -0,0 +1,42 @@
1
+# Minesweeper
2
+
3
+Add the numbers to a minesweeper board.
4
+
5
+Minesweeper is a popular game where the user has to find the mines using
6
+numeric hints that indicate how many mines are directly adjacent
7
+(horizontally, vertically, diagonally) to a square.
8
+
9
+In this exercise you have to create some code that counts the number of
10
+mines adjacent to a square and transforms boards like this (where `*`
11
+indicates a mine):
12
+
13
+    +-----+
14
+    | * * |
15
+    |  *  |
16
+    |  *  |
17
+    |     |
18
+    +-----+
19
+
20
+into this:
21
+
22
+    +-----+
23
+    |1*3*1|
24
+    |13*31|
25
+    | 2*2 |
26
+    | 111 |
27
+    +-----+
28
+
29
+
30
+To run the tests:
31
+
32
+```sh
33
+$ gradle test
34
+```
35
+
36
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
37
+
38
+
39
+
40
+## Submitting Incomplete Solutions
41
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
42
+

+ 27
- 0
exercises/nth-prime/README.md Просмотреть файл

@@ -0,0 +1,27 @@
1
+# Nth Prime
2
+
3
+Given a number n, determine what the nth prime is.
4
+
5
+By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that
6
+the 6th prime is 13.
7
+
8
+If your language provides methods in the standard library to deal with prime
9
+numbers, pretend they don't exist and implement them yourself.
10
+
11
+
12
+To run the tests:
13
+
14
+```sh
15
+$ gradle test
16
+```
17
+
18
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
19
+
20
+
21
+## Source
22
+
23
+A variation on Problem 7 at Project Euler [http://projecteuler.net/problem=7](http://projecteuler.net/problem=7)
24
+
25
+## Submitting Incomplete Solutions
26
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
27
+

+ 45
- 0
exercises/nucleotide-count/README.md Просмотреть файл

@@ -0,0 +1,45 @@
1
+# Nucleotide Count
2
+
3
+Given a DNA string, compute how many times each nucleotide occurs in the string.
4
+
5
+DNA is represented by an alphabet of the following symbols: 'A', 'C',
6
+'G', and 'T'.
7
+
8
+Each symbol represents a nucleotide, which is a fancy name for the
9
+particular molecules that happen to make up a large part of DNA.
10
+
11
+Shortest intro to biochemistry EVAR:
12
+
13
+- twigs are to birds nests as
14
+- nucleotides are to DNA and RNA as
15
+- amino acids are to proteins as
16
+- sugar is to starch as
17
+- oh crap lipids
18
+
19
+I'm not going to talk about lipids because they're crazy complex.
20
+
21
+So back to nucleotides.
22
+
23
+DNA contains four types of them: adenine (`A`), cytosine (`C`), guanine
24
+(`G`), and thymine (`T`).
25
+
26
+RNA contains a slightly different set of nucleotides, but we don't care
27
+about that for now.
28
+
29
+
30
+To run the tests:
31
+
32
+```sh
33
+$ gradle test
34
+```
35
+
36
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
37
+
38
+
39
+## Source
40
+
41
+The Calculating DNA Nucleotides_problem at Rosalind [http://rosalind.info/problems/dna/](http://rosalind.info/problems/dna/)
42
+
43
+## Submitting Incomplete Solutions
44
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
45
+

+ 97
- 0
exercises/ocr-numbers/README.md Просмотреть файл

@@ -0,0 +1,97 @@
1
+# Ocr Numbers
2
+
3
+Given a 3 x 4 grid of pipes, underscores, and spaces, determine which number is
4
+represented, or whether it is garbled.
5
+
6
+# Step One
7
+
8
+To begin with, convert a simple binary font to a string containing 0 or 1.
9
+
10
+The binary font uses pipes and underscores, four rows high and three columns wide.
11
+
12
+```
13
+     _   #
14
+    | |  # zero.
15
+    |_|  #
16
+         # the fourth row is always blank
17
+```
18
+
19
+Is converted to "0"
20
+
21
+```
22
+         #
23
+      |  # one.
24
+      |  #
25
+         # (blank fourth row)
26
+```
27
+
28
+Is converted to "1"
29
+
30
+If the input is the correct size, but not recognizable, your program should return '?'
31
+
32
+If the input is the incorrect size, your program should return an error.
33
+
34
+# Step Two
35
+
36
+Update your program to recognize multi-character binary strings, replacing garbled numbers with ?
37
+
38
+# Step Three
39
+
40
+Update your program to recognize all numbers 0 through 9, both individually and as part of a larger string.
41
+
42
+```
43
+ _ 
44
+ _|
45
+|_ 
46
+   
47
+```
48
+
49
+Is converted to "2"
50
+
51
+```
52
+      _  _     _  _  _  _  _  _  #
53
+    | _| _||_||_ |_   ||_||_|| | # decimal numbers.
54
+    ||_  _|  | _||_|  ||_| _||_| #
55
+                                 # fourth line is always blank
56
+```
57
+
58
+Is converted to "1234567890"
59
+
60
+# Step Four
61
+
62
+Update your program to handle multiple numbers, one per line. When converting several lines, join the lines with commas.
63
+
64
+```
65
+    _  _ 
66
+  | _| _|
67
+  ||_  _|
68
+         
69
+    _  _ 
70
+|_||_ |_ 
71
+  | _||_|
72
+         
73
+ _  _  _ 
74
+  ||_||_|
75
+  ||_| _|
76
+         
77
+```
78
+
79
+Is converted to "123,456,789"
80
+
81
+
82
+To run the tests:
83
+
84
+```sh
85
+$ gradle test
86
+```
87
+
88
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
89
+
90
+
91
+## Source
92
+
93
+Inspired by the Bank OCR kata [http://codingdojo.org/cgi-bin/wiki.pl?KataBankOCR](http://codingdojo.org/cgi-bin/wiki.pl?KataBankOCR)
94
+
95
+## Submitting Incomplete Solutions
96
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
97
+

+ 61
- 0
exercises/octal/README.md Просмотреть файл

@@ -0,0 +1,61 @@
1
+# Octal
2
+
3
+Convert an octal number, represented as a string (e.g. '1735263'), to its
4
+decimal equivalent using first principles (i.e. no, you may not use built-in or
5
+external libraries to accomplish the conversion).
6
+
7
+Implement octal to decimal conversion.  Given an octal input
8
+string, your program should produce a decimal output.
9
+
10
+## Note
11
+- Implement the conversion yourself.
12
+  Do not use something else to perform the conversion for you.
13
+- Treat invalid input as octal 0.
14
+
15
+## About Octal (Base-8)
16
+Decimal is a base-10 system.
17
+
18
+A number 233 in base 10 notation can be understood
19
+as a linear combination of powers of 10:
20
+
21
+- The rightmost digit gets multiplied by 10^0 = 1
22
+- The next number gets multiplied by 10^1 = 10
23
+- ...
24
+- The *n*th number gets multiplied by 10^*(n-1)*.
25
+- All these values are summed.
26
+
27
+So:
28
+```
29
+   233 # decimal
30
+ = 2*10^2 + 3*10^1 + 3*10^0
31
+ = 2*100  + 3*10   + 3*1
32
+```
33
+
34
+Octal is similar, but uses powers of 8 rather than powers of 10.
35
+
36
+So:
37
+```
38
+   233 # octal
39
+ = 2*8^2 + 3*8^1 + 3*8^0
40
+ = 2*64  + 3*8   + 3*1
41
+ = 128   + 24    + 3
42
+ = 155
43
+```
44
+
45
+
46
+To run the tests:
47
+
48
+```sh
49
+$ gradle test
50
+```
51
+
52
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
53
+
54
+
55
+## Source
56
+
57
+All of Computer Science [http://www.wolframalpha.com/input/?i=base+8](http://www.wolframalpha.com/input/?i=base+8)
58
+
59
+## Submitting Incomplete Solutions
60
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
61
+

+ 52
- 0
exercises/palindrome-products/README.md Просмотреть файл

@@ -0,0 +1,52 @@
1
+# Palindrome Products
2
+
3
+Detect palindrome products in a given range.
4
+
5
+A palindromic number is a number that remains the same when its digits are
6
+reversed. For example, `121` is a palindromic number but `112` is not.
7
+
8
+Given the definition of a palindromic number, we define a palindrome _product_
9
+to be the product `c`, such that `a * b = c`, where `c` is a palindromic number and
10
+ `a` and `b` are integers (possibly, but _not_ necessarily palindromic numbers).
11
+
12
+For example, the palindromic number 9009 can be written as the palindrome
13
+product: `91 * 99 = 9009`.
14
+
15
+It's possible (and indeed common) for a palindrome product to be the product
16
+of multiple combinations of numbers. For example, the palindrome product `9` has
17
+the factors `(1, 9)`, `(3, 3)`, and `(9, 1)`.
18
+
19
+Write a program that given a range of integers, returns the smallest and largest
20
+palindromic product within that range, along with all of it's factors.
21
+
22
+## Example 1
23
+
24
+Given the range `[1, 9]` (both inclusive)...
25
+
26
+The smallest product is `1`. It's factors are `(1, 1)`.
27
+The largest product is `9`. It's factors are `(1, 9)`, `(3, 3)`, and `(9, 1)`.
28
+
29
+## Example 2
30
+
31
+Given the range `[10, 99]` (both inclusive)...
32
+
33
+The smallest palindrome product is `121`. It's factors are `(11, 11)`.
34
+The largest palindrome product is `9009`. It's factors are `(91, 99)` and `(99, 91)`.
35
+
36
+
37
+To run the tests:
38
+
39
+```sh
40
+$ gradle test
41
+```
42
+
43
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
44
+
45
+
46
+## Source
47
+
48
+Problem 4 at Project Euler [http://projecteuler.net/problem=4](http://projecteuler.net/problem=4)
49
+
50
+## Submitting Incomplete Solutions
51
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
52
+

+ 27
- 0
exercises/pangram/README.md Просмотреть файл

@@ -0,0 +1,27 @@
1
+# Pangram
2
+
3
+Determine if a sentence is a pangram. A pangram (Greek: παν γράμμα, pan gramma,
4
+"every letter") is a sentence using every letter of the alphabet at least once.
5
+The best known English pangram is: 
6
+> The quick brown fox jumps over the lazy dog.
7
+
8
+The alphabet used consists of ASCII letters `a` to `z`, inclusive, and is case
9
+insensitive. Input will not contain non-ASCII symbols.
10
+
11
+
12
+To run the tests:
13
+
14
+```sh
15
+$ gradle test
16
+```
17
+
18
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
19
+
20
+
21
+## Source
22
+
23
+Wikipedia [https://en.wikipedia.org/wiki/Pangram](https://en.wikipedia.org/wiki/Pangram)
24
+
25
+## Submitting Incomplete Solutions
26
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
27
+

+ 33
- 0
exercises/pascals-triangle/README.md Просмотреть файл

@@ -0,0 +1,33 @@
1
+# Pascals Triangle
2
+
3
+Compute Pascal's triangle up to a given number of rows.
4
+
5
+In Pascal's Triangle each number is computed by adding the numbers to
6
+the right and left of the current position in the previous row.
7
+
8
+```plain
9
+    1
10
+   1 1
11
+  1 2 1
12
+ 1 3 3 1
13
+1 4 6 4 1
14
+# ... etc
15
+```
16
+
17
+
18
+To run the tests:
19
+
20
+```sh
21
+$ gradle test
22
+```
23
+
24
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
25
+
26
+
27
+## Source
28
+
29
+Pascal's Triangle at Wolfram Math World [http://mathworld.wolfram.com/PascalsTriangle.html](http://mathworld.wolfram.com/PascalsTriangle.html)
30
+
31
+## Submitting Incomplete Solutions
32
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
33
+

+ 36
- 0
exercises/perfect-numbers/README.md Просмотреть файл

@@ -0,0 +1,36 @@
1
+# Perfect Numbers
2
+
3
+Determine if a number is perfect, abundant, or deficient based on
4
+Nicomachus' (60 - 120 CE) classification scheme for natural numbers.
5
+
6
+The Greek mathematician [Nicomachus](https://en.wikipedia.org/wiki/Nicomachus) devised a classification scheme for natural numbers, identifying each as belonging uniquely to the categories of **perfect**, **abundant**, or **deficient** based on their [aliquot sum](https://en.wikipedia.org/wiki/Aliquot_sum). The aliquot sum is defined as the sum of the factors of a number not including the number itself. For example, the aliquot sum of 15 is (1 + 3 + 5) = 9
7
+
8
+- **Perfect**: aliquot sum = number 
9
+  - 6 is a perfect number because (1 + 2 + 3) = 6
10
+  - 28 is a perfect number because (1 + 2 + 4 + 7 + 14) = 28
11
+- **Abundant**: aliquot sum > number
12
+  - 12 is an abundant number because (1 + 2 + 3 + 4 + 6) = 16
13
+  - 24 is an abundant number because (1 + 2 + 3 + 4 + 6 + 8 + 12) = 36
14
+- **Deficient**: aliquot sum < number
15
+  - 8 is a deficient number because (1 + 2 + 4) = 7
16
+  - Prime numbers are deficient
17
+  
18
+Implement a way to determine whether a given number is **perfect**. Depending on your language track, you may also need to implement a way to determine whether a given number is **abundant** or **deficient**.
19
+
20
+
21
+To run the tests:
22
+
23
+```sh
24
+$ gradle test
25
+```
26
+
27
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
28
+
29
+
30
+## Source
31
+
32
+Taken from Chapter 2 of Functional Thinking by Neal Ford. [http://shop.oreilly.com/product/0636920029687.do](http://shop.oreilly.com/product/0636920029687.do)
33
+
34
+## Submitting Incomplete Solutions
35
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
36
+

+ 46
- 0
exercises/phone-number/README.md Просмотреть файл

@@ -0,0 +1,46 @@
1
+# Phone Number
2
+
3
+Clean up user-entered phone numbers so that they can be sent SMS messages.
4
+
5
+The **North American Numbering Plan (NANP)** is a telephone numbering system used by many countries in North America like the United States, Canada or Bermuda. All NANP-countries share the same international country code: `1`.
6
+
7
+NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as *area code*, followed by a seven-digit local number. The first three digits of the local number represent the *exchange code*, followed by the unique four-digit number which is the *subscriber number*.
8
+
9
+
10
+The format is usually represented as
11
+```
12
+(NXX)-NXX-XXXX
13
+```
14
+where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9.
15
+
16
+Your task is to clean up differently formated telephone numbers by removing punctuation and the country code (1) if present.
17
+
18
+For example, the inputs
19
+- `+1 (613)-995-0253`
20
+- `613-995-0253`
21
+- `1 613 995 0253`
22
+- `613.995.0253`
23
+
24
+should all produce the output
25
+
26
+`6139950253`
27
+
28
+**Note:** As this exercise only deals with telephone numbers used in NANP-countries, only 1 is considered a valid country code.
29
+
30
+
31
+To run the tests:
32
+
33
+```sh
34
+$ gradle test
35
+```
36
+
37
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
38
+
39
+
40
+## Source
41
+
42
+Event Manager by JumpstartLab [http://tutorials.jumpstartlab.com/projects/eventmanager.html](http://tutorials.jumpstartlab.com/projects/eventmanager.html)
43
+
44
+## Submitting Incomplete Solutions
45
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
46
+

+ 36
- 0
exercises/pig-latin/README.md Просмотреть файл

@@ -0,0 +1,36 @@
1
+# Pig Latin
2
+
3
+Implement a program that translates from English to Pig Latin.
4
+
5
+Pig Latin is a made-up children's language that's intended to be
6
+confusing. It obeys a few simple rules (below), but when it's spoken
7
+quickly it's really difficult for non-children (and non-native speakers)
8
+to understand.
9
+
10
+- **Rule 1**: If a word begins with a vowel sound, add an "ay" sound to
11
+  the end of the word.
12
+- **Rule 2**: If a word begins with a consonant sound, move it to the
13
+  end of the word, and then add an "ay" sound to the end of the word.
14
+
15
+There are a few more rules for edge cases, and there are regional
16
+variants too.
17
+
18
+See <http://en.wikipedia.org/wiki/Pig_latin> for more details.
19
+
20
+
21
+To run the tests:
22
+
23
+```sh
24
+$ gradle test
25
+```
26
+
27
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
28
+
29
+
30
+## Source
31
+
32
+The Pig Latin exercise at Test First Teaching by Ultrasaurus [https://github.com/ultrasaurus/test-first-teaching/blob/master/learn_ruby/pig_latin/](https://github.com/ultrasaurus/test-first-teaching/blob/master/learn_ruby/pig_latin/)
33
+
34
+## Submitting Incomplete Solutions
35
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
36
+

+ 24
- 0
exercises/poker/README.md Просмотреть файл

@@ -0,0 +1,24 @@
1
+# Poker
2
+
3
+Pick the best hand(s) from a list of poker hands.
4
+
5
+See [wikipedia](https://en.wikipedia.org/wiki/List_of_poker_hands) for an
6
+overview of poker hands.
7
+
8
+
9
+To run the tests:
10
+
11
+```sh
12
+$ gradle test
13
+```
14
+
15
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
16
+
17
+
18
+## Source
19
+
20
+Inspired by the training course from Udacity. [https://www.udacity.com/course/viewer#!/c-cs212/](https://www.udacity.com/course/viewer#!/c-cs212/)
21
+
22
+## Submitting Incomplete Solutions
23
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
24
+

+ 48
- 0
exercises/prime-factors/README.md Просмотреть файл

@@ -0,0 +1,48 @@
1
+# Prime Factors
2
+
3
+Compute the prime factors of a given natural number.
4
+
5
+A prime number is only evenly divisible by itself and 1.
6
+
7
+Note that 1 is not a prime number.
8
+
9
+## Example
10
+
11
+What are the prime factors of 60?
12
+
13
+- Our first divisor is 2. 2 goes into 60, leaving 30.
14
+- 2 goes into 30, leaving 15.
15
+  - 2 doesn't go cleanly into 15. So let's move on to our next divisor, 3.
16
+- 3 goes cleanly into 15, leaving 5.
17
+  - 3 does not go cleanly into 5. The next possible factor is 4.
18
+  - 4 does not go cleanly into 5. The next possible factor is 5.
19
+- 5 does go cleanly into 5.
20
+- We're left only with 1, so now, we're done.
21
+
22
+Our successful divisors in that computation represent the list of prime
23
+factors of 60: 2, 2, 3, and 5.
24
+
25
+You can check this yourself:
26
+
27
+- 2 * 2 * 3 * 5
28
+- = 4 * 15
29
+- = 60
30
+- Success!
31
+
32
+
33
+To run the tests:
34
+
35
+```sh
36
+$ gradle test
37
+```
38
+
39
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
40
+
41
+
42
+## Source
43
+
44
+The Prime Factors Kata by Uncle Bob [http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata](http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata)
45
+
46
+## Submitting Incomplete Solutions
47
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
48
+

+ 36
- 0
exercises/pythagorean-triplet/README.md Просмотреть файл

@@ -0,0 +1,36 @@
1
+# Pythagorean Triplet
2
+
3
+A Pythagorean triplet is a set of three natural numbers, {a, b, c}, for
4
+which,
5
+
6
+```
7
+a**2 + b**2 = c**2
8
+```
9
+
10
+For example, 
11
+
12
+```
13
+3**2 + 4**2 = 9 + 16 = 25 = 5**2.
14
+```
15
+
16
+There exists exactly one Pythagorean triplet for which a + b + c = 1000.
17
+
18
+Find the product a * b * c.
19
+
20
+
21
+To run the tests:
22
+
23
+```sh
24
+$ gradle test
25
+```
26
+
27
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
28
+
29
+
30
+## Source
31
+
32
+Problem 9 at Project Euler [http://projecteuler.net/problem=9](http://projecteuler.net/problem=9)
33
+
34
+## Submitting Incomplete Solutions
35
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
36
+

+ 45
- 0
exercises/queen-attack/README.md Просмотреть файл

@@ -0,0 +1,45 @@
1
+# Queen Attack
2
+
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.
5
+
6
+In the game of chess, a queen can attack pieces which are on the same
7
+row, column, or diagonal.
8
+
9
+A chessboard can be represented by an 8 by 8 array.
10
+
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
+
14
+```plain
15
+_ _ _ _ _ _ _ _
16
+_ _ _ _ _ _ _ _
17
+_ _ _ W _ _ _ _
18
+_ _ _ _ _ _ _ _
19
+_ _ _ _ _ _ _ _
20
+_ _ _ _ _ _ B _
21
+_ _ _ _ _ _ _ _
22
+_ _ _ _ _ _ _ _
23
+```
24
+
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
+
29
+
30
+To run the tests:
31
+
32
+```sh
33
+$ gradle test
34
+```
35
+
36
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
37
+
38
+
39
+## Source
40
+
41
+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)
42
+
43
+## Submitting Incomplete Solutions
44
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
45
+

+ 36
- 0
exercises/raindrops/README.md Просмотреть файл

@@ -0,0 +1,36 @@
1
+# Raindrops
2
+
3
+Convert a number to a string, the contents of which depend on the number's factors.
4
+
5
+- If the number has 3 as a factor, output 'Pling'.
6
+- If the number has 5 as a factor, output 'Plang'.
7
+- If the number has 7 as a factor, output 'Plong'.
8
+- If the number does not have 3, 5, or 7 as a factor,
9
+  just pass the number's digits straight through.
10
+
11
+## Examples
12
+
13
+- 28's factors are 1, 2, 4, **7**, 14, 28.
14
+  - In raindrop-speak, this would be a simple "Plong".
15
+- 30's factors are 1, 2, **3**, **5**, 6, 10, 15, 30.
16
+  - In raindrop-speak, this would be a "PlingPlang".
17
+- 34 has four factors: 1, 2, 17, and 34.
18
+  - In raindrop-speak, this would be "34".
19
+
20
+
21
+To run the tests:
22
+
23
+```sh
24
+$ gradle test
25
+```
26
+
27
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
28
+
29
+
30
+## Source
31
+
32
+A variation on a famous interview question intended to weed out potential candidates. [http://jumpstartlab.com](http://jumpstartlab.com)
33
+
34
+## Submitting Incomplete Solutions
35
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
36
+

+ 79
- 0
exercises/rectangles/README.md Просмотреть файл

@@ -0,0 +1,79 @@
1
+# Rectangles
2
+
3
+Count the rectangles in an ASCII diagram like the one below.
4
+
5
+```
6
+   +--+
7
+  ++  |
8
++-++--+
9
+|  |  |
10
++--+--+
11
+```
12
+
13
+The above diagram contains 6 rectangles:
14
+
15
+```
16
+
17
+
18
++-----+
19
+|     |
20
++-----+
21
+```
22
+
23
+```
24
+   +--+
25
+   |  |
26
+   |  |
27
+   |  |
28
+   +--+
29
+```
30
+
31
+```
32
+   +--+
33
+   |  |
34
+   +--+
35
+
36
+
37
+```
38
+
39
+```
40
+       
41
+       
42
+   +--+
43
+   |  |
44
+   +--+
45
+```
46
+
47
+```
48
+       
49
+       
50
++--+
51
+|  |
52
++--+
53
+```
54
+
55
+```
56
+       
57
+  ++   
58
+  ++   
59
+       
60
+       
61
+```
62
+
63
+You may assume that the input is always a proper rectangle (i.e. the length of
64
+every line equals the length of the first line).
65
+
66
+
67
+To run the tests:
68
+
69
+```sh
70
+$ gradle test
71
+```
72
+
73
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
74
+
75
+
76
+
77
+## Submitting Incomplete Solutions
78
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
79
+

+ 37
- 0
exercises/rna-transcription/README.md Просмотреть файл

@@ -0,0 +1,37 @@
1
+# Rna Transcription
2
+
3
+Given a DNA strand, return its RNA complement (per RNA transcription).
4
+
5
+Both DNA and RNA strands are a sequence of nucleotides.
6
+
7
+The four nucleotides found in DNA are adenine (**A**), cytosine (**C**),
8
+guanine (**G**) and thymine (**T**).
9
+
10
+The four nucleotides found in RNA are adenine (**A**), cytosine (**C**),
11
+guanine (**G**) and uracil (**U**).
12
+
13
+Given a DNA strand, its transcribed RNA strand is formed by replacing
14
+each nucleotide with its complement:
15
+
16
+* `G` -> `C`
17
+* `C` -> `G`
18
+* `T` -> `A`
19
+* `A` -> `U`
20
+
21
+
22
+To run the tests:
23
+
24
+```sh
25
+$ gradle test
26
+```
27
+
28
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
29
+
30
+
31
+## Source
32
+
33
+Rosalind [http://rosalind.info/problems/rna](http://rosalind.info/problems/rna)
34
+
35
+## Submitting Incomplete Solutions
36
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
37
+

+ 34
- 0
exercises/robot-name/README.md Просмотреть файл

@@ -0,0 +1,34 @@
1
+# Robot Name
2
+
3
+Manage robot factory settings.
4
+
5
+When robots come off the factory floor, they have no name.
6
+
7
+The first time you boot them up, a random name is generated in the format
8
+of two uppercase letters followed by three digits, such as RX837 or BC811.
9
+
10
+Every once in a while we need to reset a robot to its factory settings,
11
+which means that their name gets wiped. The next time you ask, it will
12
+respond with a new random name.
13
+
14
+The names must be random: they should not follow a predictable sequence.
15
+Random names means a risk of collisions. Your solution must ensure that
16
+every existing robot has a unique name.
17
+
18
+
19
+To run the tests:
20
+
21
+```sh
22
+$ gradle test
23
+```
24
+
25
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
26
+
27
+
28
+## Source
29
+
30
+A debugging session with Paul Blackwell at gSchool. [http://gschool.it](http://gschool.it)
31
+
32
+## Submitting Incomplete Solutions
33
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
34
+

+ 46
- 0
exercises/robot-simulator/README.md Просмотреть файл

@@ -0,0 +1,46 @@
1
+# Robot Simulator
2
+
3
+Write a robot simulator.
4
+
5
+A robot factory's test facility needs a program to verify robot movements.
6
+
7
+The robots have three possible movements:
8
+
9
+- turn right
10
+- turn left
11
+- advance
12
+
13
+Robots are placed on a hypothetical infinite grid, facing a particular
14
+direction (north, east, south, or west) at a set of {x,y} coordinates,
15
+e.g., {3,8}, with coordinates increasing to the north and east.
16
+
17
+The robot then receives a number of instructions, at which point the
18
+testing facility verifies the robot's new position, and in which
19
+direction it is pointing.
20
+
21
+- The letter-string "RAALAL" means:
22
+  - Turn right
23
+  - Advance twice
24
+  - Turn left
25
+  - Advance once
26
+  - Turn left yet again
27
+- Say a robot starts at {7, 3} facing north. Then running this stream
28
+  of instructions should leave it at {9, 4} facing west.
29
+
30
+
31
+To run the tests:
32
+
33
+```sh
34
+$ gradle test
35
+```
36
+
37
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
38
+
39
+
40
+## Source
41
+
42
+Inspired by an interview question at a famous company.
43
+
44
+## Submitting Incomplete Solutions
45
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
46
+

+ 61
- 0
exercises/roman-numerals/README.md Просмотреть файл

@@ -0,0 +1,61 @@
1
+# Roman Numerals
2
+
3
+Write a function to convert from normal numbers to Roman Numerals.
4
+
5
+The Romans were a clever bunch. They conquered most of Europe and ruled
6
+it for hundreds of years. They invented concrete and straight roads and
7
+even bikinis. One thing they never discovered though was the number
8
+zero. This made writing and dating extensive histories of their exploits
9
+slightly more challenging, but the system of numbers they came up with
10
+is still in use today. For example the BBC uses Roman numerals to date
11
+their programmes.
12
+
13
+The Romans wrote numbers using letters - I, V, X, L, C, D, M. (notice
14
+these letters have lots of straight lines and are hence easy to hack
15
+into stone tablets).
16
+
17
+```
18
+ 1  => I
19
+10  => X
20
+ 7  => VII
21
+```
22
+
23
+There is no need to be able to convert numbers larger than about 3000.
24
+(The Romans themselves didn't tend to go any higher)
25
+
26
+Wikipedia says: Modern Roman numerals ... are written by expressing each
27
+digit separately starting with the left most digit and skipping any
28
+digit with a value of zero.
29
+
30
+To see this in practice, consider the example of 1990.
31
+
32
+In Roman numerals 1990 is MCMXC:
33
+
34
+1000=M
35
+900=CM
36
+90=XC
37
+
38
+2008 is written as MMVIII:
39
+
40
+2000=MM
41
+8=VIII
42
+
43
+See also: http://www.novaroma.org/via_romana/numbers.html
44
+
45
+
46
+To run the tests:
47
+
48
+```sh
49
+$ gradle test
50
+```
51
+
52
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
53
+
54
+
55
+## Source
56
+
57
+The Roman Numeral Kata [http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals](http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals)
58
+
59
+## Submitting Incomplete Solutions
60
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
61
+

+ 42
- 0
exercises/run-length-encoding/README.md Просмотреть файл

@@ -0,0 +1,42 @@
1
+# Run Length Encoding
2
+
3
+Implement run-length encoding and decoding.
4
+
5
+Run-length encoding (RLE) is a simple form of data compression, where runs
6
+(consecutive data elements) are replaced by just one data value and count.
7
+
8
+For example we can represent the original 53 characters with only 13.
9
+
10
+```
11
+"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"  ->  "12WB12W3B24WB"
12
+```
13
+
14
+RLE allows the original data to be perfectly reconstructed from
15
+the compressed data, which makes it a lossless data compression.
16
+
17
+```
18
+"AABCCCDEEEE"  ->  "2AB3CD4E"  ->  "AABCCCDEEEE"
19
+```
20
+
21
+For simplicity, you can assume that the unencoded string will only contain
22
+the letters A through Z (either lower or upper case) and whitespace. This way 
23
+data to be encoded will never contain any numbers and numbers inside data to 
24
+be decoded always represent the count for the following character.
25
+
26
+
27
+To run the tests:
28
+
29
+```sh
30
+$ gradle test
31
+```
32
+
33
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
34
+
35
+
36
+## Source
37
+
38
+Wikipedia [https://en.wikipedia.org/wiki/Run-length_encoding](https://en.wikipedia.org/wiki/Run-length_encoding)
39
+
40
+## Submitting Incomplete Solutions
41
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
42
+

+ 45
- 0
exercises/saddle-points/README.md Просмотреть файл

@@ -0,0 +1,45 @@
1
+# Saddle Points
2
+
3
+Detect saddle points in a matrix.
4
+
5
+So say you have a matrix like so:
6
+
7
+```plain
8
+    0  1  2
9
+  |---------
10
+0 | 9  8  7
11
+1 | 5  3  2     <--- saddle point at (1,0)
12
+2 | 6  6  7
13
+```
14
+
15
+It has a saddle point at (1, 0).
16
+
17
+It's called a "saddle point" because it is greater than or equal to
18
+every element in its row and the less than or equal to every element in
19
+its column.
20
+
21
+A matrix may have zero or more saddle points.
22
+
23
+Your code should be able to provide the (possibly empty) list of all the
24
+saddle points for any given matrix.
25
+
26
+Note that you may find other definitions of matrix saddle points online,
27
+but the tests for this exercise follow the above unambiguous definition.
28
+
29
+
30
+To run the tests:
31
+
32
+```sh
33
+$ gradle test
34
+```
35
+
36
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
37
+
38
+
39
+## Source
40
+
41
+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)
42
+
43
+## Submitting Incomplete Solutions
44
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
45
+

+ 56
- 0
exercises/scrabble-score/README.md Просмотреть файл

@@ -0,0 +1,56 @@
1
+# Scrabble Score
2
+
3
+Given a word, compute the scrabble score for that word.
4
+
5
+## Letter Values
6
+
7
+You'll need these:
8
+
9
+```plain
10
+Letter                           Value
11
+A, E, I, O, U, L, N, R, S, T       1
12
+D, G                               2
13
+B, C, M, P                         3
14
+F, H, V, W, Y                      4
15
+K                                  5
16
+J, X                               8
17
+Q, Z                               10
18
+```
19
+
20
+## Examples
21
+"cabbage" should be scored as worth 14 points:
22
+
23
+- 3 points for C
24
+- 1 point for A, twice
25
+- 3 points for B, twice
26
+- 2 points for G
27
+- 1 point for E
28
+
29
+And to total:
30
+
31
+- `3 + 2*1 + 2*3 + 2 + 1`
32
+- = `3 + 2 + 6 + 3`
33
+- = `5 + 9`
34
+- = 14
35
+
36
+## Extensions
37
+- You can play a double or a triple letter.
38
+- You can play a double or a triple word.
39
+
40
+
41
+To run the tests:
42
+
43
+```sh
44
+$ gradle test
45
+```
46
+
47
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
48
+
49
+
50
+## Source
51
+
52
+Inspired by the Extreme Startup game [https://github.com/rchatley/extreme_startup](https://github.com/rchatley/extreme_startup)
53
+
54
+## Submitting Incomplete Solutions
55
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
56
+

+ 47
- 0
exercises/secret-handshake/README.md Просмотреть файл

@@ -0,0 +1,47 @@
1
+# Secret Handshake
2
+
3
+> There are 10 types of people in the world: Those who understand
4
+> binary, and those who don't.
5
+
6
+You and your fellow cohort of those in the "know" when it comes to
7
+binary decide to come up with a secret "handshake".
8
+
9
+```
10
+1 = wink
11
+10 = double blink
12
+100 = close your eyes
13
+1000 = jump
14
+
15
+
16
+10000 = Reverse the order of the operations in the secret handshake.
17
+```
18
+
19
+Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.
20
+
21
+Here's a couple of examples:
22
+
23
+Given the input 3, the function would return the array
24
+["wink", "double blink"] because 3 is 11 in binary.
25
+
26
+Given the input 19, the function would return the array
27
+["double blink", "wink"] because 19 is 10011 in binary.
28
+Notice that the addition of 16 (10000 in binary)
29
+has caused the array to be reversed.
30
+
31
+
32
+To run the tests:
33
+
34
+```sh
35
+$ gradle test
36
+```
37
+
38
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
39
+
40
+
41
+## Source
42
+
43
+Bert, in Mary Poppins [http://www.imdb.com/character/ch0011238/quotes](http://www.imdb.com/character/ch0011238/quotes)
44
+
45
+## Submitting Incomplete Solutions
46
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
47
+

+ 39
- 0
exercises/series/README.md Просмотреть файл

@@ -0,0 +1,39 @@
1
+# Series
2
+
3
+Given a string of digits, output all the contiguous substrings of length `n` in
4
+that string.
5
+
6
+For example, the string "49142" has the following 3-digit series:
7
+
8
+- 491
9
+- 914
10
+- 142
11
+
12
+And the following 4-digit series:
13
+
14
+- 4914
15
+- 9142
16
+
17
+And if you ask for a 6-digit series from a 5-digit string, you deserve
18
+whatever you get.
19
+
20
+Note that these series are only required to occupy *adjacent positions*
21
+in the input; the digits need not be *numerically consecutive*.
22
+
23
+
24
+To run the tests:
25
+
26
+```sh
27
+$ gradle test
28
+```
29
+
30
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
31
+
32
+
33
+## Source
34
+
35
+A subset of the Problem 8 at Project Euler [http://projecteuler.net/problem=8](http://projecteuler.net/problem=8)
36
+
37
+## Submitting Incomplete Solutions
38
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
39
+

+ 46
- 0
exercises/sieve/README.md Просмотреть файл

@@ -0,0 +1,46 @@
1
+# Sieve
2
+
3
+Use the Sieve of Eratosthenes to find all the primes from 2 up to a given
4
+number.
5
+
6
+The Sieve of Eratosthenes is a simple, ancient algorithm for finding all
7
+prime numbers up to any given limit. It does so by iteratively marking as
8
+composite (i.e. not prime) the multiples of each prime,
9
+starting with the multiples of 2.
10
+
11
+Create your range, starting at two and continuing up to and including the given limit. (i.e. [2, limit])
12
+
13
+The algorithm consists of repeating the following over and over:
14
+
15
+- take the next available unmarked number in your list (it is prime)
16
+- mark all the multiples of that number (they are not prime)
17
+
18
+Repeat until you have processed each number in your range.
19
+
20
+When the algorithm terminates, all the numbers in the list that have not
21
+been marked are prime.
22
+
23
+The wikipedia article has a useful graphic that explains the algorithm:
24
+https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
25
+
26
+Notice that this is a very specific algorithm, and the tests don't check
27
+that you've implemented the algorithm, only that you've come up with the
28
+correct list of primes.
29
+
30
+
31
+To run the tests:
32
+
33
+```sh
34
+$ gradle test
35
+```
36
+
37
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
38
+
39
+
40
+## Source
41
+
42
+Sieve of Eratosthenes at Wikipedia [http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes](http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes)
43
+
44
+## Submitting Incomplete Solutions
45
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
46
+

+ 109
- 0
exercises/simple-cipher/README.md Просмотреть файл

@@ -0,0 +1,109 @@
1
+# Simple Cipher
2
+
3
+Implement a simple shift cipher like Caesar and a more secure substitution cipher.
4
+
5
+## Step 1
6
+
7
+"If he had anything confidential to say, he wrote it in cipher, that is,
8
+by so changing the order of the letters of the alphabet, that not a word
9
+could be made out. If anyone wishes to decipher these, and get at their
10
+meaning, he must substitute the fourth letter of the alphabet, namely D,
11
+for A, and so with the others."
12
+—Suetonius, Life of Julius Caesar
13
+
14
+Ciphers are very straight-forward algorithms that allow us to render
15
+text less readable while still allowing easy deciphering. They are
16
+vulnerable to many forms of cryptoanalysis, but we are lucky that
17
+generally our little sisters are not cryptoanalysts.
18
+
19
+The Caesar Cipher was used for some messages from Julius Caesar that
20
+were sent afield. Now Caesar knew that the cipher wasn't very good, but
21
+he had one ally in that respect: almost nobody could read well. So even
22
+being a couple letters off was sufficient so that people couldn't
23
+recognize the few words that they did know.
24
+
25
+Your task is to create a simple shift cipher like the Caesar Cipher.
26
+This image is a great example of the Caesar Cipher:
27
+
28
+![Caesar Cipher][1]
29
+
30
+For example:
31
+
32
+Giving "iamapandabear" as input to the encode function returns the cipher "ldpdsdqgdehdu". Obscure enough to keep our message secret in transit.
33
+
34
+When "ldpdsdqgdehdu" is put into the decode function it would return
35
+the original "iamapandabear" letting your friend read your original
36
+message.
37
+
38
+## Step 2
39
+
40
+Shift ciphers are no fun though when your kid sister figures it out. Try
41
+amending the code to allow us to specify a key and use that for the
42
+shift distance. This is called a substitution cipher.
43
+
44
+Here's an example:
45
+
46
+Given the key "aaaaaaaaaaaaaaaaaa", encoding the string "iamapandabear"
47
+would return the original "iamapandabear".
48
+
49
+Given the key "ddddddddddddddddd", encoding our string "iamapandabear"
50
+would return the obscured "lpdsdqgdehdu"
51
+
52
+In the example above, we've set a = 0 for the key value. So when the
53
+plaintext is added to the key, we end up with the same message coming
54
+out. So "aaaa" is not an ideal key. But if we set the key to "dddd", we
55
+would get the same thing as the Caesar Cipher.
56
+
57
+## Step 3
58
+
59
+The weakest link in any cipher is the human being. Let's make your
60
+substitution cipher a little more fault tolerant by providing a source
61
+of randomness and ensuring that the key is not composed of numbers or
62
+capital letters.
63
+
64
+If someone doesn't submit a key at all, generate a truly random key of
65
+at least 100 characters in length, accessible via Cipher#key (the #
66
+syntax means instance variable)
67
+
68
+If the key submitted has capital letters or numbers, throw an
69
+ArgumentError with a message to that effect.
70
+
71
+## Extensions
72
+
73
+Shift ciphers work by making the text slightly odd, but are vulnerable
74
+to frequency analysis. Substitution ciphers help that, but are still
75
+very vulnerable when the key is short or if spaces are preserved. Later
76
+on you'll see one solution to this problem in the exercise
77
+"crypto-square".
78
+
79
+If you want to go farther in this field, the questions begin to be about
80
+how we can exchange keys in a secure way. Take a look at [Diffie-Hellman
81
+on Wikipedia][dh] for one of the first implementations of this scheme.
82
+
83
+[1]: https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Caesar_cipher_left_shift_of_3.svg/320px-Caesar_cipher_left_shift_of_3.svg.png
84
+[dh]: http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange
85
+
86
+This exercise has three test classes: SimpleCipherStepOneTest.java, SimpleCipherStepTwoTest.java and SimpleCipherStepThreeTest.java.
87
+
88
+To run only one test class (e.g. in this example SimpleCipherStepOneTest.java):
89
+```
90
+$ gradle test --tests *StepOne*
91
+```
92
+
93
+
94
+To run the tests:
95
+
96
+```sh
97
+$ gradle test
98
+```
99
+
100
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
101
+
102
+
103
+## Source
104
+
105
+Substitution Cipher at Wikipedia [http://en.wikipedia.org/wiki/Substitution_cipher](http://en.wikipedia.org/wiki/Substitution_cipher)
106
+
107
+## Submitting Incomplete Solutions
108
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
109
+

+ 40
- 0
exercises/simple-linked-list/README.md Просмотреть файл

@@ -0,0 +1,40 @@
1
+# Simple Linked List
2
+
3
+Write a simple linked list implementation that uses Elements and a List.
4
+
5
+The linked list is a fundamental data structure in computer science,
6
+often used in the implementation of other data structures. They're
7
+pervasive in functional programming languages, such as Clojure, Erlang,
8
+or Haskell, but far less common in imperative languages such as Ruby or
9
+Python.
10
+
11
+The simplest kind of linked list is a singly linked list. Each element in the
12
+list contains data and a "next" field pointing to the next element in the list
13
+of elements.
14
+
15
+This variant of linked lists is often used to represent sequences or
16
+push-down stacks (also called a LIFO stack; Last In, First Out).
17
+
18
+As a first take, lets create a singly linked list to contain the range (1..10),
19
+and provide functions to reverse a linked list and convert to and from arrays.
20
+
21
+When implementing this in a language with built-in linked lists,
22
+implement your own abstract data type.
23
+
24
+
25
+To run the tests:
26
+
27
+```sh
28
+$ gradle test
29
+```
30
+
31
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
32
+
33
+
34
+## Source
35
+
36
+Inspired by 'Data Structures and Algorithms with Object-Oriented Design Patterns in Ruby', singly linked-lists. [http://www.brpreiss.com/books/opus8/html/page96.html#SECTION004300000000000000000](http://www.brpreiss.com/books/opus8/html/page96.html#SECTION004300000000000000000)
37
+
38
+## Submitting Incomplete Solutions
39
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
40
+

+ 36
- 0
exercises/space-age/README.md Просмотреть файл

@@ -0,0 +1,36 @@
1
+# Space Age
2
+
3
+Given an age in seconds, calculate how old someone would be on:
4
+
5
+   - Earth: orbital period 365.25 Earth days, or 31557600 seconds
6
+   - Mercury: orbital period 0.2408467 Earth years
7
+   - Venus: orbital period 0.61519726 Earth years
8
+   - Mars: orbital period 1.8808158 Earth years
9
+   - Jupiter: orbital period 11.862615 Earth years
10
+   - Saturn: orbital period 29.447498 Earth years
11
+   - Uranus: orbital period 84.016846 Earth years
12
+   - Neptune: orbital period 164.79132 Earth years
13
+
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 Earth-years old.
16
+
17
+If you're wondering why Pluto didn't make the cut, go watch [this
18
+youtube video](http://www.youtube.com/watch?v=Z_2gbGXzFbs).
19
+
20
+
21
+To run the tests:
22
+
23
+```sh
24
+$ gradle test
25
+```
26
+
27
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
28
+
29
+
30
+## Source
31
+
32
+Partially inspired by Chapter 1 in Chris Pine's online Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=01](http://pine.fm/LearnToProgram/?Chapter=01)
33
+
34
+## Submitting Incomplete Solutions
35
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
36
+

+ 42
- 0
exercises/spiral-matrix/README.md Просмотреть файл

@@ -0,0 +1,42 @@
1
+# Spiral Matrix
2
+
3
+Given the size, return a square matrix of numbers in spiral order.
4
+
5
+The matrix should be filled with natural numbers, starting from 1
6
+in the top-left corner, increasing in an inward, clockwise spiral order,
7
+like these examples:
8
+
9
+###### Spiral matrix of size 3
10
+
11
+```plain
12
+1 2 3
13
+8 9 4
14
+7 6 5
15
+```
16
+
17
+###### Spiral matrix of size 4
18
+
19
+```plain
20
+ 1  2  3 4
21
+12 13 14 5
22
+11 16 15 6
23
+10  9  8 7
24
+```
25
+
26
+
27
+To run the tests:
28
+
29
+```sh
30
+$ gradle test
31
+```
32
+
33
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
34
+
35
+
36
+## Source
37
+
38
+Reddit r/dailyprogrammer challenge #320 [Easy] Spiral Ascension. [https://www.reddit.com/r/dailyprogrammer/comments/6i60lr/20170619_challenge_320_easy_spiral_ascension/](https://www.reddit.com/r/dailyprogrammer/comments/6i60lr/20170619_challenge_320_easy_spiral_ascension/)
39
+
40
+## Submitting Incomplete Solutions
41
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
42
+

+ 52
- 0
exercises/strain/README.md Просмотреть файл

@@ -0,0 +1,52 @@
1
+# Strain
2
+
3
+Implement the `keep` and `discard` operation on collections. Given a collection
4
+and a predicate on the collection's elements, `keep` returns a new collection
5
+containing those elements where the predicate is true, while `discard` returns
6
+a new collection containing those elements where the predicate is false.
7
+
8
+For example, given the collection of numbers:
9
+
10
+- 1, 2, 3, 4, 5
11
+
12
+And the predicate:
13
+
14
+- is the number even?
15
+
16
+Then your keep operation should produce:
17
+
18
+- 2, 4
19
+
20
+While your discard operation should produce:
21
+
22
+- 1, 3, 5
23
+
24
+Note that the union of keep and discard is all the elements.
25
+
26
+The functions may be called `keep` and `discard`, or they may need different
27
+names in order to not clash with existing functions or concepts in your
28
+language.
29
+
30
+## Restrictions
31
+
32
+Keep your hands off that filter/reject/whatchamacallit functionality
33
+provided by your standard library!  Solve this one yourself using other
34
+basic tools instead.
35
+
36
+
37
+To run the tests:
38
+
39
+```sh
40
+$ gradle test
41
+```
42
+
43
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
44
+
45
+
46
+## Source
47
+
48
+Conversation with James Edward Gray II [https://twitter.com/jeg2](https://twitter.com/jeg2)
49
+
50
+## Submitting Incomplete Solutions
51
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
52
+

+ 33
- 0
exercises/sublist/README.md Просмотреть файл

@@ -0,0 +1,33 @@
1
+# Sublist
2
+
3
+Given two lists determine if the first list is contained within the second
4
+list, if the second list is contained within the first list, if both lists are
5
+contained within each other or if none of these are true.
6
+
7
+Specifically, a list A is a sublist of list B if by dropping 0 or more elements
8
+from the front of B and 0 or more elements from the back of B you get a list
9
+that's completely equal to A.
10
+
11
+Examples:
12
+
13
+ * A = [1, 2, 3], B = [1, 2, 3, 4, 5], A is a sublist of B
14
+ * A = [3, 4, 5], B = [1, 2, 3, 4, 5], A is a sublist of B
15
+ * A = [3, 4], B = [1, 2, 3, 4, 5], A is a sublist of B
16
+ * A = [1, 2, 3], B = [1, 2, 3], A is equal to B
17
+ * A = [1, 2, 3, 4, 5], B = [2, 3, 4], A is a superlist of B
18
+ * A = [1, 2, 4], B = [1, 2, 3, 4, 5], A is not a superlist of, sublist of or equal to B
19
+
20
+
21
+To run the tests:
22
+
23
+```sh
24
+$ gradle test
25
+```
26
+
27
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
28
+
29
+
30
+
31
+## Submitting Incomplete Solutions
32
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
33
+

+ 30
- 0
exercises/sum-of-multiples/README.md Просмотреть файл

@@ -0,0 +1,30 @@
1
+# Sum Of Multiples
2
+
3
+Given a number, find the sum of all the multiples of particular numbers up to
4
+but not including that number.
5
+
6
+If we list all the natural numbers up to but not including 20 that are
7
+multiples of either 3 or 5, we get 3, 5, 6 and 9, 10, 12, 15, and 18.
8
+
9
+The sum of these multiples is 78.
10
+
11
+Given a number, find the sum of the multiples of a given set of numbers,
12
+up to but not including that number.
13
+
14
+
15
+To run the tests:
16
+
17
+```sh
18
+$ gradle test
19
+```
20
+
21
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
22
+
23
+
24
+## Source
25
+
26
+A variation on Problem 1 at Project Euler [http://projecteuler.net/problem=1](http://projecteuler.net/problem=1)
27
+
28
+## Submitting Incomplete Solutions
29
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
30
+

+ 77
- 0
exercises/transpose/README.md Просмотреть файл

@@ -0,0 +1,77 @@
1
+# Transpose
2
+
3
+Given an input text output it transposed.
4
+
5
+Roughly explained, the transpose of a matrix:
6
+
7
+```
8
+ABC
9
+DEF
10
+```
11
+
12
+is given by:
13
+
14
+```
15
+AD
16
+BE
17
+CF
18
+```
19
+
20
+Rows become columns and columns become rows. See <https://en.wikipedia.org/wiki/Transpose>.
21
+
22
+If the input has rows of different lengths, this is to be solved as follows:
23
+
24
+- Pad to the left with spaces.
25
+- Don't pad to the right.
26
+
27
+Therefore, transposing this matrix:
28
+
29
+```
30
+ABC
31
+DE
32
+```
33
+
34
+results in:
35
+
36
+```
37
+AD
38
+BE
39
+C
40
+```
41
+
42
+And transposing:
43
+
44
+```
45
+AB
46
+DEF
47
+```
48
+
49
+results in:
50
+
51
+```
52
+AD
53
+BE
54
+ F
55
+```
56
+
57
+In general, all characters from the input should also be present in the transposed output.
58
+That means that if a column in the input text contains only spaces on its bottom-most row(s), 
59
+the corresponding output row should contain the spaces in its right-most column(s).
60
+
61
+
62
+To run the tests:
63
+
64
+```sh
65
+$ gradle test
66
+```
67
+
68
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
69
+
70
+
71
+## Source
72
+
73
+Reddit r/dailyprogrammer challenge #270 [Easy]. [https://www.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text](https://www.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text)
74
+
75
+## Submitting Incomplete Solutions
76
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
77
+

+ 38
- 0
exercises/triangle/README.md Просмотреть файл

@@ -0,0 +1,38 @@
1
+# Triangle
2
+
3
+Determine if a triangle is equilateral, isosceles, or scalene.
4
+
5
+An _equilateral_ triangle has all three sides the same length.<br/>
6
+An _isosceles_ triangle has at least two sides the same length. (It is sometimes
7
+specified as having exactly two sides the same length, but for the purposes of
8
+this exercise we'll say at least two.)<br/>
9
+A _scalene_ triangle has all sides of different lengths.
10
+
11
+## Note
12
+
13
+For a shape to be a triangle at all, all sides have to be of length > 0, and 
14
+the sum of the lengths of any two sides must be greater than or equal to the 
15
+length of the third side. See [Triangle Inequality](https://en.wikipedia.org/wiki/Triangle_inequality).
16
+
17
+## Dig Deeper
18
+
19
+The case where the sum of the lengths of two sides _equals_ that of the 
20
+third is known as a _degenerate_ triangle - it has zero area and looks like 
21
+a single line. Feel free to add your own code/tests to check for degenerate triangles.
22
+
23
+To run the tests:
24
+
25
+```sh
26
+$ gradle test
27
+```
28
+
29
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
30
+
31
+
32
+## Source
33
+
34
+The Ruby Koans triangle project, parts 1 & 2 [http://rubykoans.com](http://rubykoans.com)
35
+
36
+## Submitting Incomplete Solutions
37
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
38
+

+ 40
- 0
exercises/trinary/README.md Просмотреть файл

@@ -0,0 +1,40 @@
1
+# Trinary
2
+
3
+Convert a trinary number, represented as a string (e.g. '102012'), to its
4
+decimal equivalent using first principles.
5
+
6
+The program should consider strings specifying an invalid trinary as the
7
+value 0.
8
+
9
+Trinary numbers contain three symbols: 0, 1, and 2.
10
+
11
+The last place in a trinary number is the 1's place. The second to last
12
+is the 3's place, the third to last is the 9's place, etc.
13
+
14
+```bash
15
+# "102012"
16
+    1       0       2       0       1       2    # the number
17
+1*3^5 + 0*3^4 + 2*3^3 + 0*3^2 + 1*3^1 + 2*3^0    # the value
18
+  243 +     0 +    54 +     0 +     3 +     2 =  302
19
+```
20
+
21
+If your language provides a method in the standard library to perform the
22
+conversion, pretend it doesn't exist and implement it yourself.
23
+
24
+
25
+To run the tests:
26
+
27
+```sh
28
+$ gradle test
29
+```
30
+
31
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
32
+
33
+
34
+## Source
35
+
36
+All of Computer Science [http://www.wolframalpha.com/input/?i=binary&a=*C.binary-_*MathWorld-](http://www.wolframalpha.com/input/?i=binary&a=*C.binary-_*MathWorld-)
37
+
38
+## Submitting Incomplete Solutions
39
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
40
+

+ 47
- 0
exercises/twelve-days/README.md Просмотреть файл

@@ -0,0 +1,47 @@
1
+# Twelve Days
2
+
3
+Output the lyrics to 'The Twelve Days of Christmas'.
4
+
5
+```
6
+On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree.
7
+
8
+On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree.
9
+
10
+On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
11
+
12
+On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
13
+
14
+On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
15
+
16
+On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
17
+
18
+On the seventh day of Christmas my true love gave to me, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
19
+
20
+On the eighth day of Christmas my true love gave to me, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
21
+
22
+On the ninth day of Christmas my true love gave to me, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
23
+
24
+On the tenth day of Christmas my true love gave to me, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
25
+
26
+On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
27
+
28
+On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
29
+```
30
+
31
+
32
+To run the tests:
33
+
34
+```sh
35
+$ gradle test
36
+```
37
+
38
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
39
+
40
+
41
+## Source
42
+
43
+Wikipedia [http://en.wikipedia.org/wiki/The_Twelve_Days_of_Christmas_(song)](http://en.wikipedia.org/wiki/The_Twelve_Days_of_Christmas_(song))
44
+
45
+## Submitting Incomplete Solutions
46
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
47
+

+ 100
- 0
exercises/two-fer/README.md Просмотреть файл

@@ -0,0 +1,100 @@
1
+# Two Fer
2
+
3
+`Two-fer` or `2-fer` is short for two for one. One for you and one for me.
4
+
5
+```
6
+"One for X, one for me."
7
+```
8
+
9
+When X is a name or "you".
10
+
11
+If the given name is "Alice", the result should be "One for Alice, one for me."
12
+If no name is given, the result should be "One for you, one for me."
13
+
14
+
15
+## Test-Driven Development
16
+
17
+As programmers mature, they eventually want to test their code.
18
+
19
+Here at Exercism we simulate [Test-Driven
20
+Development](http://en.wikipedia.org/wiki/Test-driven_development) (TDD), where
21
+you write your tests before writing any functionality. The simulation comes in
22
+the form of a pre-written test suite, which will signal that you have solved
23
+the problem.
24
+
25
+It will also provide you with a safety net to explore other solutions without
26
+breaking the functionality.
27
+
28
+### A typical TDD workflow on Exercism:
29
+
30
+1. Run the test file and pick one test that's failing.
31
+2. Write some code to fix the test you picked.
32
+3. Re-run the tests to confirm the test is now passing.
33
+4. Repeat from step 1.
34
+5. Submit your solution (`exercism submit /path/to/file`)
35
+
36
+## Instructions
37
+
38
+Submissions are encouraged to be general, within reason. Having said that, it's
39
+also important not to over-engineer a solution.
40
+
41
+It's important to remember that the goal is to make code as expressive and
42
+readable as we can.
43
+
44
+Most Java exercises include multiple test cases. These cases are structured to
45
+support a useful process known as
46
+[test-driven development (TDD)](https://en.wikipedia.org/wiki/Test-driven_development).
47
+TDD involves repeating a structured cycle that helps programmers build complex
48
+functionality piece by piece rather than all at once. That cycle can be
49
+described as follows:
50
+
51
+1. Add a test that describes one piece of desired functionality your code is
52
+currently missing.
53
+2. Run the tests to verify that this newly-added test fails.
54
+3. Update your existing code until:
55
+    - All the old tests continue to pass;
56
+    - The new test also passes.
57
+4. [Clean up](https://en.wikipedia.org/wiki/Code_refactoring) your code, making
58
+sure that all tests continue to pass. This typically involves renaming
59
+variables, removing duplicated chunks of logic, removing leftover logging, etc.
60
+5. Return to step 1 until all desired functionality has been built!
61
+
62
+The test files in this track contain _all_ the tests your solution should pass
63
+to be considered valid. That doesn't immediately seem to be compatible with the
64
+cycle described above, in which tests are written one by one. However, the
65
+tool that we use to write our tests, [JUnit](http://junit.org), provides an
66
+[@Ignore](http://junit.sourceforge.net/javadoc/org/junit/Ignore.html)
67
+[annotation](https://docs.oracle.com/javase/tutorial/java/annotations/) that
68
+can be used to temporarily skip an already-written test. Using this annotation,
69
+we make sure that the test files we deliver to you satisfy the following rules:
70
+
71
+- The first test in any test file is _not_ skipped by default.
72
+- All but the first test in any test file _are_ skipped by default.
73
+
74
+This allows you to simulate the TDD cycle by following these slightly-modified
75
+steps:
76
+
77
+1. Run the tests to verify that _at most one_ test currently fails.
78
+2. Update your existing code until all the non-skipped tests pass.
79
+3. Clean up your code, making sure that all non-skipped tests continue to pass.
80
+4. Remove the topmost `@Ignore` annotation in the test file.
81
+5. Return to step 1 until no tests are skipped and all tests pass!
82
+
83
+
84
+
85
+To run the tests:
86
+
87
+```sh
88
+$ gradle test
89
+```
90
+
91
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
92
+
93
+
94
+## Source
95
+
96
+This is an exercise to introduce users to basic programming constructs, just after hello World. [https://en.wikipedia.org/wiki/Two-fer](https://en.wikipedia.org/wiki/Two-fer)
97
+
98
+## Submitting Incomplete Solutions
99
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
100
+

+ 31
- 0
exercises/word-count/README.md Просмотреть файл

@@ -0,0 +1,31 @@
1
+# Word Count
2
+
3
+Given a phrase, count the occurrences of each word in that phrase.
4
+
5
+For example for the input `"olly olly in come free"`
6
+
7
+```plain
8
+olly: 2
9
+in: 1
10
+come: 1
11
+free: 1
12
+```
13
+
14
+
15
+
16
+To run the tests:
17
+
18
+```sh
19
+$ gradle test
20
+```
21
+
22
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
23
+
24
+
25
+## Source
26
+
27
+This is a classic toy problem, but we were reminded of it by seeing it in the Go Tour.
28
+
29
+## Submitting Incomplete Solutions
30
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
31
+

+ 42
- 0
exercises/word-search/README.md Просмотреть файл

@@ -0,0 +1,42 @@
1
+# Word Search
2
+
3
+In word search puzzles you get a square of letters and have to find specific
4
+words in them.
5
+
6
+For example:
7
+
8
+```
9
+jefblpepre
10
+camdcimgtc
11
+oivokprjsm
12
+pbwasqroua
13
+rixilelhrs
14
+wolcqlirpc
15
+screeaumgr
16
+alxhpburyi
17
+jalaycalmp
18
+clojurermt
19
+```
20
+
21
+There are several programming languages hidden in the above square.
22
+
23
+Words can be hidden in all kinds of directions: left-to-right, right-to-left,
24
+vertical and diagonal.
25
+
26
+Given a puzzle and a list of words return the location of the first and last
27
+letter of each word.
28
+
29
+
30
+To run the tests:
31
+
32
+```sh
33
+$ gradle test
34
+```
35
+
36
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
37
+
38
+
39
+
40
+## Submitting Incomplete Solutions
41
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
42
+

+ 75
- 0
exercises/wordy/README.md Просмотреть файл

@@ -0,0 +1,75 @@
1
+# Wordy
2
+
3
+Parse and evaluate simple math word problems returning the answer as an integer.
4
+
5
+
6
+## Iteration 1 — Addition
7
+
8
+Add two numbers together.
9
+
10
+> What is 5 plus 13?
11
+
12
+Evaluates to 18.
13
+
14
+Handle large numbers and negative numbers.
15
+
16
+
17
+## Iteration 2 — Subtraction, Multiplication and Division
18
+
19
+Now, perform the other three operations.
20
+
21
+> What is 7 minus 5?
22
+
23
+2
24
+
25
+> What is 6 multiplied by 4?
26
+
27
+24
28
+
29
+> What is 25 divided by 5?
30
+
31
+5
32
+
33
+
34
+## Iteration 3 — Multiple Operations
35
+
36
+Handle a set of operations, in sequence.
37
+
38
+Since these are verbal word problems, evaluate the expression from
39
+left-to-right, _ignoring the typical order of operations._
40
+
41
+> What is 5 plus 13 plus 6?
42
+
43
+24
44
+
45
+> What is 3 plus 2 multiplied by 3?
46
+
47
+15  (i.e. not 9)
48
+
49
+
50
+## Bonus — Exponentials
51
+
52
+If you'd like, handle exponentials.
53
+
54
+> What is 2 raised to the 5th power?
55
+
56
+32
57
+
58
+
59
+
60
+To run the tests:
61
+
62
+```sh
63
+$ gradle test
64
+```
65
+
66
+For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
67
+
68
+
69
+## Source
70
+
71
+Inspired by one of the generated questions in the Extreme Startup game. [https://github.com/rchatley/extreme_startup](https://github.com/rchatley/extreme_startup)
72
+
73
+## Submitting Incomplete Solutions
74
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
75
+