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,11 +3,12 @@ id: 597f24c1dda4e70f53c79c81
|
||||
title: 斐波那契序列
|
||||
challengeType: 5
|
||||
videoUrl: ''
|
||||
dashedName: fibonacci-sequence
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
<p>编写一个函数来生成第<big>n <sup>个</sup></big> Fibonacci数。 </p> /// <p>第<big>n <sup>个</sup></big> Fibonacci数由下式给出:/// </p><p> F <sub>n</sub> = F <sub>n-1</sub> + F <sub>n-2</sub> </p> /// <p>该系列的前两个术语是0,1。 </p> /// <p>因此,该系列是:0,1,1,2,3,5,8,13 ...... </p> ///
|
||||
<p>编写一个函数来生成第<big>n <sup>个</sup></big> Fibonacci数。 </p> /// <p>第<big>n <sup>个</sup></big> Fibonacci数由下式给出:/// </p><p> F <sub>n</sub> = F <sub>n-1</sub> + F <sub>n-2</sub> </p> /// <p>该系列的前两个术语是0,1。 </p> /// <p>因此,该系列是:0,1,1,2,3,5,8,13 ...... </p> ///
|
||||
|
||||
# --hints--
|
||||
|
||||
@ -41,5 +42,26 @@ assert.equal(fibonacci(5), 3);
|
||||
assert.equal(fibonacci(10), 34);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function fibonacci(n) {
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
function fibonacci(n) {
|
||||
let a = 0, b = 1, t;
|
||||
while (--n >= 0) {
|
||||
t = a;
|
||||
a = b;
|
||||
b += t;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user