feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
This commit is contained in:
committed by
GitHub
parent
0095583028
commit
ee1e8abd87
@ -3,6 +3,7 @@ id: 5966f99c45e8976909a85575
|
||||
title: 一周中的天
|
||||
challengeType: 5
|
||||
videoUrl: ''
|
||||
dashedName: day-of-the-week
|
||||
---
|
||||
|
||||
# --description--
|
||||
@ -35,5 +36,35 @@ assert.deepEqual(findXmasSunday(1970, 2017), firstSolution);
|
||||
assert.deepEqual(findXmasSunday(2008, 2121), secondSolution);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
```js
|
||||
const firstSolution = [1977, 1983, 1988, 1994, 2005, 2011, 2016];
|
||||
const secondSolution = [2011, 2016, 2022, 2033, 2039, 2044, 2050, 2061, 2067, 2072, 2078, 2089, 2095, 2101, 2107, 2112, 2118];
|
||||
```
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function findXmasSunday(start, end) {
|
||||
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
function findXmasSunday(start, end) {
|
||||
const xmasSunday = [];
|
||||
for (let year = start; year <= end; year++) {
|
||||
const xmas = new Date(year, 11, 25);
|
||||
if (xmas.getDay() === 0) {
|
||||
xmasSunday.push(year);
|
||||
}
|
||||
}
|
||||
return xmasSunday;
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user