-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync docs, metadata, and tests (#845)
* Sync docs and metadata * Sync pig-latin tests
- Loading branch information
Showing
13 changed files
with
139 additions
and
91 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
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
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
28 changes: 1 addition & 27 deletions
28
exercises/practice/collatz-conjecture/.docs/instructions.md
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 |
---|---|---|
@@ -1,29 +1,3 @@ | ||
# Instructions | ||
|
||
The Collatz Conjecture or 3x+1 problem can be summarized as follows: | ||
|
||
Take any positive integer n. | ||
If n is even, divide n by 2 to get n / 2. | ||
If n is odd, multiply n by 3 and add 1 to get 3n + 1. | ||
Repeat the process indefinitely. | ||
The conjecture states that no matter which number you start with, you will always reach 1 eventually. | ||
|
||
Given a number n, return the number of steps required to reach 1. | ||
|
||
## Examples | ||
|
||
Starting with n = 12, the steps would be as follows: | ||
|
||
0. 12 | ||
1. 6 | ||
2. 3 | ||
3. 10 | ||
4. 5 | ||
5. 16 | ||
6. 8 | ||
7. 4 | ||
8. 2 | ||
9. 1 | ||
|
||
Resulting in 9 steps. | ||
So for input n = 12, the return value would be 9. | ||
Given a positive integer, return the number of steps it takes to reach 1 according to the rules of the Collatz Conjecture. |
28 changes: 28 additions & 0 deletions
28
exercises/practice/collatz-conjecture/.docs/introduction.md
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,28 @@ | ||
# Introduction | ||
|
||
One evening, you stumbled upon an old notebook filled with cryptic scribbles, as though someone had been obsessively chasing an idea. | ||
On one page, a single question stood out: **Can every number find its way to 1?** | ||
It was tied to something called the **Collatz Conjecture**, a puzzle that has baffled thinkers for decades. | ||
|
||
The rules were deceptively simple. | ||
Pick any positive integer. | ||
|
||
- If it's even, divide it by 2. | ||
- If it's odd, multiply it by 3 and add 1. | ||
|
||
Then, repeat these steps with the result, continuing indefinitely. | ||
|
||
Curious, you picked number 12 to test and began the journey: | ||
|
||
12 ➜ 6 ➜ 3 ➜ 10 ➜ 5 ➜ 16 ➜ 8 ➜ 4 ➜ 2 ➜ 1 | ||
|
||
Counting from the second number (6), it took 9 steps to reach 1, and each time the rules repeated, the number kept changing. | ||
At first, the sequence seemed unpredictable — jumping up, down, and all over. | ||
Yet, the conjecture claims that no matter the starting number, we'll always end at 1. | ||
|
||
It was fascinating, but also puzzling. | ||
Why does this always seem to work? | ||
Could there be a number where the process breaks down, looping forever or escaping into infinity? | ||
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. | ||
|
||
[collatz-prize]: https://mathprize.net/posts/collatz-conjecture/ |
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
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
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
# Instructions | ||
|
||
Given students' names along with the grade that they are in, create a roster for the school. | ||
Given students' names along with the grade they are in, create a roster for the school. | ||
|
||
In the end, you should be able to: | ||
|
||
- Add a student's name to the roster for a grade | ||
- Add a student's name to the roster for a grade: | ||
- "Add Jim to grade 2." | ||
- "OK." | ||
- Get a list of all students enrolled in a grade | ||
- Get a list of all students enrolled in a grade: | ||
- "Which students are in grade 2?" | ||
- "We've only got Jim just now." | ||
- "We've only got Jim right now." | ||
- Get a sorted list of all students in all grades. | ||
Grades should sort as 1, 2, 3, etc., and students within a grade should be sorted alphabetically by name. | ||
- "Who all is enrolled in school right now?" | ||
Grades should be sorted as 1, 2, 3, etc., and students within a grade should be sorted alphabetically by name. | ||
- "Who is enrolled in school right now?" | ||
- "Let me think. | ||
We have Anna, Barb, and Charlie in grade 1, Alex, Peter, and Zoe in grade 2 and Jim in grade 5. | ||
So the answer is: Anna, Barb, Charlie, Alex, Peter, Zoe and Jim" | ||
We have Anna, Barb, and Charlie in grade 1, Alex, Peter, and Zoe in grade 2, and Jim in grade 5. | ||
So the answer is: Anna, Barb, Charlie, Alex, Peter, Zoe, and Jim." | ||
|
||
Note that all our students only have one name (It's a small town, what do you want?) and each student cannot be added more than once to a grade or the roster. | ||
In fact, when a test attempts to add the same student more than once, your implementation should indicate that this is incorrect. | ||
Note that all our students only have one name (it's a small town, what do you want?), and each student cannot be added more than once to a grade or the roster. | ||
If a test attempts to add the same student more than once, your implementation should indicate that this is incorrect. |
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
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# Introduction | ||
|
||
Bob is a thief. | ||
After months of careful planning, he finally manages to crack the security systems of a fancy store. | ||
Lhakpa is a [Sherpa][sherpa] mountain guide and porter. | ||
After months of careful planning, the expedition Lhakpa works for is about to leave. | ||
She will be paid the value she carried to the base camp. | ||
|
||
In front of him are many items, each with a value and weight. | ||
Bob would gladly take all of the items, but his knapsack can only hold so much weight. | ||
Bob has to carefully consider which items to take so that the total value of his selection is maximized. | ||
In front of her are many items, each with a value and weight. | ||
Lhakpa would gladly take all of the items, but her knapsack can only hold so much weight. | ||
|
||
[sherpa]: https://en.wikipedia.org/wiki/Sherpa_people#Mountaineering |
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,12 @@ | ||
# Introduction | ||
|
||
You've joined LinkLine, a leading communications company working to ensure reliable connections for everyone. | ||
The team faces a big challenge: users submit phone numbers in all sorts of formats — dashes, spaces, dots, parentheses, and even prefixes. | ||
Some numbers are valid, while others are impossible to use. | ||
|
||
Your mission is to turn this chaos into order. | ||
You'll clean up valid numbers, formatting them appropriately for use in the system. | ||
At the same time, you'll identify and filter out any invalid entries. | ||
|
||
The success of LinkLine's operations depends on your ability to separate the useful from the unusable. | ||
Are you ready to take on the challenge and keep the connections running smoothly? |
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 |
---|---|---|
@@ -1,69 +1,79 @@ | ||
# This is an auto-generated file. Regular comments will be removed when this | ||
# file is regenerated. Regenerating will not touch any manually added keys, | ||
# so comments can be added in a "comment" key. | ||
# This is an auto-generated file. | ||
# | ||
# Regenerating this file via `configlet sync` will: | ||
# - Recreate every `description` key/value pair | ||
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications | ||
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) | ||
# - Preserve any other key/value pair | ||
# | ||
# As user-added comments (using the # character) will be removed when this file | ||
# is regenerated, comments can be added via a `comment` key. | ||
|
||
[11567f84-e8c6-4918-aedb-435f0b73db57] | ||
description = "word beginning with a" | ||
description = "ay is added to words that start with vowels -> word beginning with a" | ||
|
||
[f623f581-bc59-4f45-9032-90c3ca9d2d90] | ||
description = "word beginning with e" | ||
description = "ay is added to words that start with vowels -> word beginning with e" | ||
|
||
[7dcb08b3-23a6-4e8a-b9aa-d4e859450d58] | ||
description = "word beginning with i" | ||
description = "ay is added to words that start with vowels -> word beginning with i" | ||
|
||
[0e5c3bff-266d-41c8-909f-364e4d16e09c] | ||
description = "word beginning with o" | ||
description = "ay is added to words that start with vowels -> word beginning with o" | ||
|
||
[614ba363-ca3c-4e96-ab09-c7320799723c] | ||
description = "word beginning with u" | ||
description = "ay is added to words that start with vowels -> word beginning with u" | ||
|
||
[bf2538c6-69eb-4fa7-a494-5a3fec911326] | ||
description = "word beginning with a vowel and followed by a qu" | ||
description = "ay is added to words that start with vowels -> word beginning with a vowel and followed by a qu" | ||
|
||
[e5be8a01-2d8a-45eb-abb4-3fcc9582a303] | ||
description = "word beginning with p" | ||
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with p" | ||
|
||
[d36d1e13-a7ed-464d-a282-8820cb2261ce] | ||
description = "word beginning with k" | ||
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with k" | ||
|
||
[d838b56f-0a89-4c90-b326-f16ff4e1dddc] | ||
description = "word beginning with x" | ||
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with x" | ||
|
||
[bce94a7a-a94e-4e2b-80f4-b2bb02e40f71] | ||
description = "word beginning with q without a following u" | ||
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with q without a following u" | ||
|
||
[e59dbbe8-ccee-4619-a8e9-ce017489bfc0] | ||
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with consonant and vowel containing qu" | ||
|
||
[c01e049a-e3e2-451c-bf8e-e2abb7e438b8] | ||
description = "word beginning with ch" | ||
description = "some letter clusters are treated like a single consonant -> word beginning with ch" | ||
|
||
[9ba1669e-c43f-4b93-837a-cfc731fd1425] | ||
description = "word beginning with qu" | ||
description = "some letter clusters are treated like a single consonant -> word beginning with qu" | ||
|
||
[92e82277-d5e4-43d7-8dd3-3a3b316c41f7] | ||
description = "word beginning with qu and a preceding consonant" | ||
description = "some letter clusters are treated like a single consonant -> word beginning with qu and a preceding consonant" | ||
|
||
[79ae4248-3499-4d5b-af46-5cb05fa073ac] | ||
description = "word beginning with th" | ||
description = "some letter clusters are treated like a single consonant -> word beginning with th" | ||
|
||
[e0b3ae65-f508-4de3-8999-19c2f8e243e1] | ||
description = "word beginning with thr" | ||
description = "some letter clusters are treated like a single consonant -> word beginning with thr" | ||
|
||
[20bc19f9-5a35-4341-9d69-1627d6ee6b43] | ||
description = "word beginning with sch" | ||
description = "some letter clusters are treated like a single consonant -> word beginning with sch" | ||
|
||
[54b796cb-613d-4509-8c82-8fbf8fc0af9e] | ||
description = "word beginning with yt" | ||
description = "some letter clusters are treated like a single vowel -> word beginning with yt" | ||
|
||
[8c37c5e1-872e-4630-ba6e-d20a959b67f6] | ||
description = "word beginning with xr" | ||
description = "some letter clusters are treated like a single vowel -> word beginning with xr" | ||
|
||
[a4a36d33-96f3-422c-a233-d4021460ff00] | ||
description = "y is treated like a consonant at the beginning of a word" | ||
description = "position of y in a word determines if it is a consonant or a vowel -> y is treated like a consonant at the beginning of a word" | ||
|
||
[adc90017-1a12-4100-b595-e346105042c7] | ||
description = "y is treated like a vowel at the end of a consonant cluster" | ||
description = "position of y in a word determines if it is a consonant or a vowel -> y is treated like a vowel at the end of a consonant cluster" | ||
|
||
[29b4ca3d-efe5-4a95-9a54-8467f2e5e59a] | ||
description = "y as second letter in two letter word" | ||
description = "position of y in a word determines if it is a consonant or a vowel -> y as second letter in two letter word" | ||
|
||
[44616581-5ce3-4a81-82d0-40c7ab13d2cf] | ||
description = "a whole phrase" | ||
description = "phrases are translated -> a whole phrase" |
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