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:
@ -10,18 +10,22 @@ dashedName: problem-313-sliding-game
|
||||
|
||||
In a sliding game a counter may slide horizontally or vertically into an empty space. The objective of the game is to move the red counter from the top left corner of a grid to the bottom right corner; the space always starts in the bottom right corner. For example, the following sequence of pictures show how the game can be completed in five moves on a 2 by 2 grid.
|
||||
|
||||
Let S(m,n) represent the minimum number of moves to complete the game on an m by n grid. For example, it can be verified that S(5,4) = 25.
|
||||
<img class="img-responsive center-block" alt="completing game in five moves on grid 2x2" src="https://cdn.freecodecamp.org/curriculum/project-euler/sliding-game-1.gif" style="background-color: white; padding: 10px;">
|
||||
|
||||
There are exactly 5482 grids for which S(m,n) = p2, where p < 100 is prime.
|
||||
Let $S(m, n)$ represent the minimum number of moves to complete the game on an $m$ by $n$ grid. For example, it can be verified that $S(5, 4) = 25$.
|
||||
|
||||
How many grids does S(m,n) = p2, where p < 106 is prime?
|
||||
<img class="img-responsive center-block" alt="initial grid state and final grid state for game on grid 5x4" src="https://cdn.freecodecamp.org/curriculum/project-euler/sliding-game-2.gif" style="background-color: white; padding: 10px;">
|
||||
|
||||
There are exactly 5482 grids for which $S(m, n) = p^2$, where $p < 100$ is prime.
|
||||
|
||||
How many grids does $S(m, n) = p^2$, where $p < {10}^6$ is prime?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler313()` should return 2057774861813004.
|
||||
`slidingGame()` should return `2057774861813004`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler313(), 2057774861813004);
|
||||
assert.strictEqual(slidingGame(), 2057774861813004);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +33,12 @@ assert.strictEqual(euler313(), 2057774861813004);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler313() {
|
||||
function slidingGame() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler313();
|
||||
slidingGame();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
Reference in New Issue
Block a user