fix(curriculum): clean-up Project Euler 301-320 (#42926)

* fix: clean-up Project Euler 301-320

* fix: corrections from review

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
gikf
2021-07-21 17:59:56 +02:00
committed by GitHub
parent c3eb8189af
commit 32dbe23f5e
20 changed files with 253 additions and 197 deletions

View File

@ -8,20 +8,22 @@ dashedName: problem-309-integer-ladders
# --description--
In the classic "Crossing Ladders" problem, we are given the lengths x and y of two ladders resting on the opposite walls of a narrow, level street. We are also given the height h above the street where the two ladders cross and we are asked to find the width of the street (w).
In the classic "Crossing Ladders" problem, we are given the lengths $x$ and $y$ of two ladders resting on the opposite walls of a narrow, level street. We are also given the height $h$ above the street where the two ladders cross and we are asked to find the width of the street ($w$).
Here, we are only concerned with instances where all four variables are positive integers. For example, if x = 70, y = 119 and h = 30, we can calculate that w = 56.
<img class="img-responsive center-block" alt="ladders x and y, crossing at the height h, and resting on opposite walls of the street of width w" src="https://cdn.freecodecamp.org/curriculum/project-euler/integer-ladders.gif" style="background-color: white; padding: 10px;">
In fact, for integer values x, y, h and 0 &lt; x &lt; y &lt; 200, there are only five triplets (x,y,h) producing integer solutions for w: (70, 119, 30), (74, 182, 21), (87, 105, 35), (100, 116, 35) and (119, 175, 40).
Here, we are only concerned with instances where all four variables are positive integers. For example, if $x = 70$, $y = 119$ and $h = 30$, we can calculate that $w = 56$.
For integer values x, y, h and 0 &lt; x &lt; y &lt; 1 000 000, how many triplets (x,y,h) produce integer solutions for w?
In fact, for integer values $x$, $y$, $h$ and $0 &lt; x &lt; y &lt; 200$, there are only five triplets ($x$, $y$, $h$) producing integer solutions for $w$: (70, 119, 30), (74, 182, 21), (87, 105, 35), (100, 116, 35) and (119, 175, 40).
For integer values $x$, $y$, $h$ and $0 &lt; x &lt; y &lt; 1\\,000\\,000$, how many triplets ($x$, $y$, $h$) produce integer solutions for $w$?
# --hints--
`euler309()` should return 210139.
`integerLadders()` should return `210139`.
```js
assert.strictEqual(euler309(), 210139);
assert.strictEqual(integerLadders(), 210139);
```
# --seed--
@ -29,12 +31,12 @@ assert.strictEqual(euler309(), 210139);
## --seed-contents--
```js
function euler309() {
function integerLadders() {
return true;
}
euler309();
integerLadders();
```
# --solutions--