-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from exercism/generate-readme
Generate static exercise README templates
- Loading branch information
Showing
21 changed files
with
594 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# {{ .Spec.Name }} | ||
|
||
{{ .Spec.Description -}} | ||
{{- with .Hints }} | ||
{{ . }} | ||
{{ end }} | ||
{{- with .TrackInsert }} | ||
{{ . }} | ||
{{ end }} | ||
{{- with .Spec.Credits -}} | ||
## Source | ||
|
||
{{ . }} | ||
{{ end }} | ||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Allergies | ||
|
||
Given a person's allergy score, determine whether or not they're allergic to a given item, and their full list of allergies. | ||
|
||
An allergy test produces a single numeric score which contains the | ||
information about all the allergies the person has (that they were | ||
tested for). | ||
|
||
The list of items (and their value) that were tested are: | ||
|
||
* eggs (1) | ||
* peanuts (2) | ||
* shellfish (4) | ||
* strawberries (8) | ||
* tomatoes (16) | ||
* chocolate (32) | ||
* pollen (64) | ||
* cats (128) | ||
|
||
So if Tom is allergic to peanuts and chocolate, he gets a score of 34. | ||
|
||
Now, given just that score of 34, your program should be able to say: | ||
|
||
- Whether Tom is allergic to any one of those allergens listed above. | ||
- All the allergens Tom is allergic to. | ||
|
||
Note: a given score may include allergens **not** listed above (i.e. | ||
allergens that score 256, 512, 1024, etc.). Your program should | ||
ignore those components of the score. For example, if the allergy | ||
score is 257, your program should only report the eggs (1) allergy. | ||
|
||
## Source | ||
|
||
Jumpstart Lab Warm-up [http://jumpstartlab.com](http://jumpstartlab.com) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Anagram | ||
|
||
Given a word and a list of possible anagrams, select the correct sublist. | ||
|
||
Given `"listen"` and a list of candidates like `"enlists" "google" | ||
"inlets" "banana"` the program should return a list containing | ||
`"inlets"`. | ||
## Source | ||
|
||
Inspired by the Extreme Startup game [https://github.com/rchatley/extreme_startup](https://github.com/rchatley/extreme_startup) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Atbash Cipher | ||
|
||
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East. | ||
|
||
The Atbash cipher is a simple substitution cipher that relies on | ||
transposing all the letters in the alphabet such that the resulting | ||
alphabet is backwards. The first letter is replaced with the last | ||
letter, the second with the second-last, and so on. | ||
|
||
An Atbash cipher for the Latin alphabet would be as follows: | ||
|
||
```plain | ||
Plain: abcdefghijklmnopqrstuvwxyz | ||
Cipher: zyxwvutsrqponmlkjihgfedcba | ||
``` | ||
|
||
It is a very weak cipher because it only has one possible key, and it is | ||
a simple monoalphabetic substitution cipher. However, this may not have | ||
been an issue in the cipher's time. | ||
|
||
Ciphertext is written out in groups of fixed length, the traditional group size | ||
being 5 letters, and punctuation is excluded. This is to make it harder to guess | ||
things based on word boundaries. | ||
|
||
## Examples | ||
- Encoding `test` gives `gvhg` | ||
- Decoding `gvhg` gives `test` | ||
- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog` | ||
## Source | ||
|
||
Wikipedia [http://en.wikipedia.org/wiki/Atbash](http://en.wikipedia.org/wiki/Atbash) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Binary | ||
|
||
Convert a binary number, represented as a string (e.g. '101010'), to its decimal equivalent using first principles. | ||
|
||
Implement binary to decimal conversion. Given a binary input | ||
string, your program should produce a decimal output. The | ||
program should handle invalid inputs. | ||
|
||
## Note | ||
- Implement the conversion yourself. | ||
Do not use something else to perform the conversion for you. | ||
|
||
## About Binary (Base-2) | ||
Decimal is a base-10 system. | ||
|
||
A number 23 in base 10 notation can be understood | ||
as a linear combination of powers of 10: | ||
|
||
- The rightmost digit gets multiplied by 10^0 = 1 | ||
- The next number gets multiplied by 10^1 = 10 | ||
- ... | ||
- The *n*th number gets multiplied by 10^*(n-1)*. | ||
- All these values are summed. | ||
|
||
So: `23 => 2*10^1 + 3*10^0 => 2*10 + 3*1 = 23 base 10` | ||
|
||
Binary is similar, but uses powers of 2 rather than powers of 10. | ||
|
||
So: `101 => 1*2^2 + 0*2^1 + 1*2^0 => 1*4 + 0*2 + 1*1 => 4 + 1 => 5 base 10`. | ||
## Source | ||
|
||
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-) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Bob | ||
|
||
Bob is a lackadaisical teenager. In conversation, his responses are very limited. | ||
|
||
Bob answers 'Sure.' if you ask him a question. | ||
|
||
He answers 'Whoa, chill out!' if you yell at him. | ||
|
||
He says 'Fine. Be that way!' if you address him without actually saying | ||
anything. | ||
|
||
He answers 'Whatever.' to anything else. | ||
## Source | ||
|
||
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) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Difference Of Squares | ||
|
||
Find the difference between the square of the sum and the sum of the squares of the first N natural numbers. | ||
|
||
The square of the sum of the first ten natural numbers is | ||
(1 + 2 + ... + 10)² = 55² = 3025. | ||
|
||
The sum of the squares of the first ten natural numbers is | ||
1² + 2² + ... + 10² = 385. | ||
|
||
Hence the difference between the square of the sum of the first | ||
ten natural numbers and the sum of the squares of the first ten | ||
natural numbers is 3025 - 385 = 2640. | ||
## Source | ||
|
||
Problem 6 at Project Euler [http://projecteuler.net/problem=6](http://projecteuler.net/problem=6) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Etl | ||
|
||
We are going to do the `Transform` step of an Extract-Transform-Load. | ||
|
||
### ETL | ||
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 | ||
we're going to migrate this." | ||
|
||
(Typically, this is followed by, "We're only going to need to run this | ||
once." That's then typically followed by much forehead slapping and | ||
moaning about how stupid we could possibly be.) | ||
|
||
### The goal | ||
We're going to extract some scrabble scores from a legacy system. | ||
|
||
The old system stored a list of letters per score: | ||
|
||
- 1 point: "A", "E", "I", "O", "U", "L", "N", "R", "S", "T", | ||
- 2 points: "D", "G", | ||
- 3 points: "B", "C", "M", "P", | ||
- 4 points: "F", "H", "V", "W", "Y", | ||
- 5 points: "K", | ||
- 8 points: "J", "X", | ||
- 10 points: "Q", "Z", | ||
|
||
The shiny new scrabble system instead stores the score per letter, which | ||
makes it much faster and easier to calculate the score for a word. It | ||
also stores the letters in lower-case regardless of the case of the | ||
input letters: | ||
|
||
- "a" is worth 1 point. | ||
- "b" is worth 3 points. | ||
- "c" is worth 3 points. | ||
- "d" is worth 2 points. | ||
- Etc. | ||
|
||
Your mission, should you choose to accept it, is to transform the legacy data | ||
format to the shiny new format. | ||
|
||
### Notes | ||
|
||
A final note about scoring, Scrabble is played around the world in a | ||
variety of languages, each with its own unique scoring table. For | ||
example, an "E" is scored at 2 in the Māori-language version of the | ||
game while being scored at 4 in the Hawaiian-language version. | ||
## Source | ||
|
||
The Jumpstart Lab team [http://jumpstartlab.com](http://jumpstartlab.com) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Gigasecond | ||
|
||
Calculate the moment when someone has lived for 10^9 seconds. | ||
|
||
A gigasecond is 10^9 (1,000,000,000) seconds. | ||
## Source | ||
|
||
Chapter 9 in Chris Pine's online Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=09](http://pine.fm/LearnToProgram/?Chapter=09) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Grains | ||
|
||
Calculate the number of grains of wheat on a chessboard given that the number | ||
on each square doubles. | ||
|
||
There once was a wise servant who saved the life of a prince. The king | ||
promised to pay whatever the servant could dream up. Knowing that the | ||
king loved chess, the servant told the king he would like to have grains | ||
of wheat. One grain on the first square of a chess board. Two grains on | ||
the next. Four on the third, and so on. | ||
|
||
There are 64 squares on a chessboard. | ||
|
||
Write code that shows: | ||
- how many grains were on each square, and | ||
- the total number of grains | ||
|
||
|
||
## For bonus points | ||
|
||
Did you get the tests passing and the code clean? If you want to, these | ||
are some additional things you could try: | ||
|
||
- Optimize for speed. | ||
- Optimize for readability. | ||
|
||
Then please share your thoughts in a comment on the submission. Did this | ||
experiment make the code better? Worse? Did you learn anything from it? | ||
## Source | ||
|
||
JavaRanch Cattle Drive, exercise 6 [http://www.javaranch.com/grains.jsp](http://www.javaranch.com/grains.jsp) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Hamming | ||
|
||
Calculate the Hamming difference between two DNA strands. | ||
|
||
A mutation is simply a mistake that occurs during the creation or | ||
copying of a nucleic acid, in particular DNA. Because nucleic acids are | ||
vital to cellular functions, mutations tend to cause a ripple effect | ||
throughout the cell. Although mutations are technically mistakes, a very | ||
rare mutation may equip the cell with a beneficial attribute. In fact, | ||
the macro effects of evolution are attributable by the accumulated | ||
result of beneficial microscopic mutations over many generations. | ||
|
||
The simplest and most common type of nucleic acid mutation is a point | ||
mutation, which replaces one base with another at a single nucleotide. | ||
|
||
By counting the number of differences between two homologous DNA strands | ||
taken from different genomes with a common ancestor, we get a measure of | ||
the minimum number of point mutations that could have occurred on the | ||
evolutionary path between the two strands. | ||
|
||
This is called the 'Hamming distance'. | ||
|
||
It is found by comparing two DNA strands and counting how many of the | ||
nucleotides are different from their equivalent in the other string. | ||
|
||
GAGCCTACTAACGGGAT | ||
CATCGTAATGACGGCCT | ||
^ ^ ^ ^ ^ ^^ | ||
|
||
The Hamming distance between these two DNA strands is 7. | ||
|
||
# Implementation notes | ||
|
||
The Hamming distance is only defined for sequences of equal length. This means | ||
that based on the definition, each language could deal with getting sequences | ||
of equal length differently. | ||
## Source | ||
|
||
The Calculating Point Mutations problem at Rosalind [http://rosalind.info/problems/hamm/](http://rosalind.info/problems/hamm/) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Hello World | ||
|
||
The classical introductory exercise. Just say "Hello, World!". | ||
|
||
["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is | ||
the traditional first program for beginning programming in a new language | ||
or environment. | ||
|
||
The objectives are simple: | ||
|
||
- Write a function that returns the string "Hello, World!". | ||
- Run the test suite and make sure that it succeeds. | ||
- Submit your solution and check it at the website. | ||
|
||
If everything goes well, you will be ready to fetch your first real exercise. | ||
## Source | ||
|
||
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) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Leap | ||
|
||
Given a year, report if it is a leap year. | ||
|
||
The tricky thing here is that a leap year in the Gregorian calendar occurs: | ||
|
||
```plain | ||
on every year that is evenly divisible by 4 | ||
except every year that is evenly divisible by 100 | ||
unless the year is also evenly divisible by 400 | ||
``` | ||
|
||
For example, 1997 is not a leap year, but 1996 is. 1900 is not a leap | ||
year, but 2000 is. | ||
|
||
If your language provides a method in the standard library that does | ||
this look-up, pretend it doesn't exist and implement it yourself. | ||
|
||
## Notes | ||
|
||
Though our exercise adopts some very simple rules, there is more to | ||
learn! | ||
|
||
For a delightful, four minute explanation of the whole leap year | ||
phenomenon, go watch [this youtube video][video]. | ||
|
||
[video]: http://www.youtube.com/watch?v=xX96xng7sAE | ||
## Source | ||
|
||
JavaRanch Cattle Drive, exercise 3 [http://www.javaranch.com/leap.jsp](http://www.javaranch.com/leap.jsp) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
Oops, something went wrong.