fix(curriculum): clean-up Project Euler 221-240 (#42839)
* fix: clean-up Project Euler 221-240 * 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:
@ -8,34 +8,29 @@ dashedName: problem-228-minkowski-sums
|
||||
|
||||
# --description--
|
||||
|
||||
<!-- TODO Use MathJax and re-write from projecteuler.net -->
|
||||
Let $S_n$ be the regular $n$-sided polygon – or shape – whose vertices $v_k (k = 1, 2, \ldots, n)$ have coordinates:
|
||||
|
||||
Let Sn be the regular n-sided polygon – or shape – whose vertices
|
||||
$$\begin{align}
|
||||
& x_k = cos(\frac{2k - 1}{n} × 180°) \\\\
|
||||
& y_k = sin(\frac{2k - 1}{n} × 180°)
|
||||
\end{align}$$
|
||||
|
||||
vk (k = 1,2,…,n) have coordinates:
|
||||
Each $S_n$ is to be interpreted as a filled shape consisting of all points on the perimeter and in the interior.
|
||||
|
||||
xk = cos( 2k-1/n ×180° )
|
||||
The Minkowski sum, $S + T$, of two shapes $S$ and $T$ is the result of adding every point in $S$ to every point in $T$, where point addition is performed coordinate-wise: $(u, v) + (x, y) = (u + x, v + y)$.
|
||||
|
||||
yk = sin( 2k-1/n ×180° )
|
||||
For example, the sum of $S_3$ and $S_4$ is the six-sided shape shown in pink below:
|
||||
|
||||
Each Sn is to be interpreted as a filled shape consisting of all points on the perimeter and in the interior.
|
||||
<img class="img-responsive center-block" alt="image showing S_3, S_4 and S_3 + S_4" src="https://cdn.freecodecamp.org/curriculum/project-euler/minkowski-sums.png" style="background-color: white; padding: 10px;">
|
||||
|
||||
The Minkowski sum, S+T, of two shapes S and T is the result of
|
||||
|
||||
adding every point in S to every point in T, where point addition is performed coordinate-wise:
|
||||
|
||||
(u, v) + (x, y) = (u+x, v+y).
|
||||
|
||||
For example, the sum of S3 and S4 is the six-sided shape shown in pink below:
|
||||
|
||||
How many sides does S1864 + S1865 + … + S1909 have?
|
||||
How many sides does $S_{1864} + S_{1865} + \ldots + S_{1909}$ have?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler228()` should return 86226.
|
||||
`minkowskiSums()` should return `86226`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler228(), 86226);
|
||||
assert.strictEqual(minkowskiSums(), 86226);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -43,12 +38,12 @@ assert.strictEqual(euler228(), 86226);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler228() {
|
||||
function minkowskiSums() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler228();
|
||||
minkowskiSums();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
Reference in New Issue
Block a user