-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync docs, files, and metadata (#133)
- Loading branch information
Showing
16 changed files
with
111 additions
and
57 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
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
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 | ||
|
||
Your body is made up of cells that contain DNA. | ||
Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells. | ||
In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime! | ||
|
||
When cells divide, their DNA replicates too. | ||
Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information. | ||
If we compare two strands of DNA and count the differences between them, we can see how many mistakes occurred. | ||
This is known as the "Hamming distance". | ||
|
||
The Hamming distance is useful in many areas of science, not just biology, so it's a nice phrase to be familiar with :) |
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 |
---|---|---|
@@ -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
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