Skip to content

Commit 37f403e

Browse files
authored
Sync upstream problem specs (#313)
* Sync docs * Sync metadata
1 parent 63b8fd6 commit 37f403e

File tree

16 files changed

+80
-64
lines changed

16 files changed

+80
-64
lines changed
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# Instructions
22

3-
Your task is to, given a target word and a set of candidate words, to find the subset of the candidates that are anagrams of the target.
3+
Given a target word and one or more candidate words, your task is to find the candidates that are anagrams of the target.
44

55
An anagram is a rearrangement of letters to form a new word: for example `"owns"` is an anagram of `"snow"`.
66
A word is _not_ its own anagram: for example, `"stop"` is not an anagram of `"stop"`.
77

8-
The target and candidates are words of one or more ASCII alphabetic characters (`A`-`Z` and `a`-`z`).
9-
Lowercase and uppercase characters are equivalent: for example, `"PoTS"` is an anagram of `"sTOp"`, but `StoP` is not an anagram of `sTOp`.
10-
The anagram set is the subset of the candidate set that are anagrams of the target (in any order).
11-
Words in the anagram set should have the same letter case as in the candidate set.
8+
The target word and candidate words are made up of one or more ASCII alphabetic characters (`A`-`Z` and `a`-`z`).
9+
Lowercase and uppercase characters are equivalent: for example, `"PoTS"` is an anagram of `"sTOp"`, but `"StoP"` is not an anagram of `"sTOp"`.
10+
The words you need to find should be taken from the candidate words, using the same letter case.
1211

13-
Given the target `"stone"` and candidates `"stone"`, `"tones"`, `"banana"`, `"tons"`, `"notes"`, `"Seton"`, the anagram set is `"tones"`, `"notes"`, `"Seton"`.
12+
Given the target `"stone"` and the candidate words `"stone"`, `"tones"`, `"banana"`, `"tons"`, `"notes"`, and `"Seton"`, the anagram words you need to find are `"tones"`, `"notes"`, and `"Seton"`.

exercises/practice/atbash-cipher/.docs/instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Instructions
22

3-
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
3+
Create an implementation of the Atbash cipher, an ancient encryption system created in the Middle East.
44

55
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.
66
The first letter is replaced with the last letter, the second with the second-last, and so on.

exercises/practice/atbash-cipher/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"spago.dhall"
2424
]
2525
},
26-
"blurb": "Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.",
26+
"blurb": "Create an implementation of the Atbash cipher, an ancient encryption system created in the Middle East.",
2727
"source": "Wikipedia",
2828
"source_url": "https://en.wikipedia.org/wiki/Atbash"
2929
}
Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,3 @@
11
# Instructions
22

3-
The Collatz Conjecture or 3x+1 problem can be summarized as follows:
4-
5-
Take any positive integer n.
6-
If n is even, divide n by 2 to get n / 2.
7-
If n is odd, multiply n by 3 and add 1 to get 3n + 1.
8-
Repeat the process indefinitely.
9-
The conjecture states that no matter which number you start with, you will always reach 1 eventually.
10-
11-
Given a number n, return the number of steps required to reach 1.
12-
13-
## Examples
14-
15-
Starting with n = 12, the steps would be as follows:
16-
17-
0. 12
18-
1. 6
19-
2. 3
20-
3. 10
21-
4. 5
22-
5. 16
23-
6. 8
24-
7. 4
25-
8. 2
26-
9. 1
27-
28-
Resulting in 9 steps.
29-
So for input n = 12, the return value would be 9.
3+
Given a positive integer, return the number of steps it takes to reach 1 according to the rules of the Collatz Conjecture.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Introduction
2+
3+
One evening, you stumbled upon an old notebook filled with cryptic scribbles, as though someone had been obsessively chasing an idea.
4+
On one page, a single question stood out: **Can every number find its way to 1?**
5+
It was tied to something called the **Collatz Conjecture**, a puzzle that has baffled thinkers for decades.
6+
7+
The rules were deceptively simple.
8+
Pick any positive integer.
9+
10+
- If it's even, divide it by 2.
11+
- If it's odd, multiply it by 3 and add 1.
12+
13+
Then, repeat these steps with the result, continuing indefinitely.
14+
15+
Curious, you picked number 12 to test and began the journey:
16+
17+
12 ➜ 6 ➜ 3 ➜ 10 ➜ 5 ➜ 16 ➜ 8 ➜ 4 ➜ 2 ➜ 1
18+
19+
Counting from the second number (6), it took 9 steps to reach 1, and each time the rules repeated, the number kept changing.
20+
At first, the sequence seemed unpredictable — jumping up, down, and all over.
21+
Yet, the conjecture claims that no matter the starting number, we'll always end at 1.
22+
23+
It was fascinating, but also puzzling.
24+
Why does this always seem to work?
25+
Could there be a number where the process breaks down, looping forever or escaping into infinity?
26+
The notebook suggested solving this could reveal something profound — and with it, fame, [fortune][collatz-prize], and a place in history awaits whoever could unlock its secrets.
27+
28+
[collatz-prize]: https://mathprize.net/posts/collatz-conjecture/

exercises/practice/collatz-conjecture/.meta/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
]
2323
},
2424
"blurb": "Calculate the number of steps to reach 1 using the Collatz conjecture.",
25-
"source": "An unsolved problem in mathematics named after mathematician Lothar Collatz",
26-
"source_url": "https://en.wikipedia.org/wiki/3x_%2B_1_problem"
25+
"source": "Wikipedia",
26+
"source_url": "https://en.wikipedia.org/wiki/Collatz_conjecture"
2727
}

exercises/practice/hamming/.docs/instructions.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
Calculate the Hamming distance between two DNA strands.
44

5-
Your body is made up of cells that contain DNA.
6-
Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells.
7-
In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime!
8-
9-
When cells divide, their DNA replicates too.
10-
Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information.
11-
If we compare two strands of DNA and count the differences between them we can see how many mistakes occurred.
12-
This is known as the "Hamming distance".
13-
145
We read DNA using the letters C, A, G and T.
156
Two strands might look like this:
167

@@ -20,8 +11,6 @@ Two strands might look like this:
2011

2112
They have 7 differences, and therefore the Hamming distance is 7.
2213

23-
The Hamming distance is useful for lots of things in science, not just biology, so it's a nice phrase to be familiar with :)
24-
2514
## Implementation notes
2615

2716
The Hamming distance is only defined for sequences of equal length, so an attempt to calculate it between sequences of different lengths should not work.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Introduction
2+
3+
Your body is made up of cells that contain DNA.
4+
Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells.
5+
In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime!
6+
7+
When cells divide, their DNA replicates too.
8+
Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information.
9+
If we compare two strands of DNA and count the differences between them, we can see how many mistakes occurred.
10+
This is known as the "Hamming distance".
11+
12+
The Hamming distance is useful in many areas of science, not just biology, so it's a nice phrase to be familiar with :)

exercises/practice/hamming/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"spago.dhall"
2424
]
2525
},
26-
"blurb": "Calculate the Hamming difference between two DNA strands.",
26+
"blurb": "Calculate the Hamming distance between two DNA strands.",
2727
"source": "The Calculating Point Mutations problem at Rosalind",
2828
"source_url": "https://rosalind.info/problems/hamm/"
2929
}

exercises/practice/knapsack/.docs/instructions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Instructions
22

3-
Your task is to determine which items to take so that the total value of his selection is maximized, taking into account the knapsack's carrying capacity.
3+
Your task is to determine which items to take so that the total value of her selection is maximized, taking into account the knapsack's carrying capacity.
44

55
Items will be represented as a list of items.
66
Each item will have a weight and value.
77
All values given will be strictly positive.
8-
Bob can take only one of each item.
8+
Lhakpa can take only one of each item.
99

1010
For example:
1111

@@ -21,5 +21,5 @@ Knapsack Maximum Weight: 10
2121
```
2222

2323
For the above, the first item has weight 5 and value 10, the second item has weight 4 and value 40, and so on.
24-
In this example, Bob should take the second and fourth item to maximize his value, which, in this case, is 90.
25-
He cannot get more than 90 as his knapsack has a weight limit of 10.
24+
In this example, Lhakpa should take the second and fourth item to maximize her value, which, in this case, is 90.
25+
She cannot get more than 90 as her knapsack has a weight limit of 10.
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Introduction
22

3-
Bob is a thief.
4-
After months of careful planning, he finally manages to crack the security systems of a fancy store.
3+
Lhakpa is a [Sherpa][sherpa] mountain guide and porter.
4+
After months of careful planning, the expedition Lhakpa works for is about to leave.
5+
She will be paid the value she carried to the base camp.
56

6-
In front of him are many items, each with a value and weight.
7-
Bob would gladly take all of the items, but his knapsack can only hold so much weight.
8-
Bob has to carefully consider which items to take so that the total value of his selection is maximized.
7+
In front of her are many items, each with a value and weight.
8+
Lhakpa would gladly take all of the items, but her knapsack can only hold so much weight.
9+
10+
[sherpa]: https://en.wikipedia.org/wiki/Sherpa_people#Mountaineering

exercises/practice/leap/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424
},
2525
"blurb": "Determine whether a given year is a leap year.",
2626
"source": "CodeRanch Cattle Drive, Assignment 3",
27-
"source_url": "https://coderanch.com/t/718816/Leap"
27+
"source_url": "https://web.archive.org/web/20240907033714/https://coderanch.com/t/718816/Leap"
2828
}

exercises/practice/pascals-triangle/.docs/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Over the next hour, your teacher reveals some amazing things hidden in this tria
1313
- It contains the Fibonacci sequence.
1414
- If you color odd and even numbers differently, you get a beautiful pattern called the [Sierpiński triangle][wikipedia-sierpinski-triangle].
1515

16-
The teacher implores you and your classmates to lookup other uses, and assures you that there are lots more!
16+
The teacher implores you and your classmates to look up other uses, and assures you that there are lots more!
1717
At that moment, the school bell rings.
1818
You realize that for the past hour, you were completely absorbed in learning about Pascal's triangle.
1919
You quickly grab your laptop from your bag and go outside, ready to enjoy both the sunshine _and_ the wonders of Pascal's triangle.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Introduction
2+
3+
You've joined LinkLine, a leading communications company working to ensure reliable connections for everyone.
4+
The team faces a big challenge: users submit phone numbers in all sorts of formats — dashes, spaces, dots, parentheses, and even prefixes.
5+
Some numbers are valid, while others are impossible to use.
6+
7+
Your mission is to turn this chaos into order.
8+
You'll clean up valid numbers, formatting them appropriately for use in the system.
9+
At the same time, you'll identify and filter out any invalid entries.
10+
11+
The success of LinkLine's operations depends on your ability to separate the useful from the unusable.
12+
Are you ready to take on the challenge and keep the connections running smoothly?

exercises/practice/rna-transcription/.docs/instructions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Instructions
22

3-
Your task is determine the RNA complement of a given DNA sequence.
3+
Your task is to determine the RNA complement of a given DNA sequence.
44

55
Both DNA and RNA strands are a sequence of nucleotides.
66

7-
The four nucleotides found in DNA are adenine (**A**), cytosine (**C**), guanine (**G**) and thymine (**T**).
7+
The four nucleotides found in DNA are adenine (**A**), cytosine (**C**), guanine (**G**), and thymine (**T**).
88

9-
The four nucleotides found in RNA are adenine (**A**), cytosine (**C**), guanine (**G**) and uracil (**U**).
9+
The four nucleotides found in RNA are adenine (**A**), cytosine (**C**), guanine (**G**), and uracil (**U**).
1010

1111
Given a DNA strand, its transcribed RNA strand is formed by replacing each nucleotide with its complement:
1212

exercises/practice/rna-transcription/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"spago.dhall"
2222
]
2323
},
24-
"blurb": "Given a DNA strand, return its RNA Complement Transcription.",
24+
"blurb": "Given a DNA strand, return its RNA complement.",
2525
"source": "Hyperphysics",
2626
"source_url": "https://web.archive.org/web/20220408112140/http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html"
2727
}

0 commit comments

Comments
 (0)