forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
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 JuliaLang#75 from exercism/generate-readme
Generate static exercise README templates
- Loading branch information
Showing
28 changed files
with
880 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,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,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,24 @@ | ||
# Complex Numbers | ||
|
||
A complex number is a number in the form `a + b * i` where `a` and `b` are real and `i` satisfies `i^2 = -1`. | ||
|
||
Assume the programming language you are using does not have an implementation of complex numbers. | ||
|
||
The Julia Base implementation of complex numbers can be found here: https://github.com/JuliaLang/julia/blob/master/base/complex.jl. | ||
|
||
--- | ||
|
||
You can work on the bonus exercises by changing `@test_skip` to `@test`. | ||
|
||
## Bonus A | ||
Implement the exponential function on complex numbers `exp(::ComplexNumber)`. | ||
|
||
## Bonus B | ||
Implement `jm` analogous to `im` so that `1 + 1jm == ComplexNumber(1, 1)`. | ||
|
||
## Source | ||
|
||
Wikipedia [https://en.wikipedia.org/wiki/Complex_number](https://en.wikipedia.org/wiki/Complex_number) | ||
|
||
## 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,16 @@ | ||
# Custom Set | ||
|
||
Create a custom set type. | ||
|
||
Sometimes it is necessary to define a custom data structure of some | ||
type, like a set. In this exercise you will define your own set. How it | ||
works internally doesn't matter, as long as it behaves like a set of | ||
unique elements. | ||
|
||
The tests require a constructor that takes an array. The internals of your custom set implementation can use other data structures but you may have to implement an outer constructor that takes exactly one array for the tests to pass. | ||
|
||
Certain methods have a unicode operator equivalent. E.g. `intersect(CustomSet([1, 2, 3, 4]), CustomSet([]))` is equivalent to `CustomSet([1, 2, 3, 4]) ∩ CustomSet([])`. | ||
|
||
|
||
## 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,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,19 @@ | ||
# Isogram | ||
|
||
Determine if a word or phrase is an isogram. | ||
|
||
An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter. | ||
|
||
Examples of isograms: | ||
|
||
- lumberjacks | ||
- background | ||
- downstream | ||
|
||
The word *isograms*, however, is not an isogram, because the s repeats. | ||
## Source | ||
|
||
Wikipedia [https://en.wikipedia.org/wiki/Isogram](https://en.wikipedia.org/wiki/Isogram) | ||
|
||
## 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.