chore(i8n,learn): processed translations
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
15047f2d90
commit
e5c44a3ae5
@ -1,30 +1,40 @@
|
||||
---
|
||||
id: 5992e222d397f00d21122931
|
||||
title: 斐波那契字
|
||||
title: Fibonacci word
|
||||
challengeType: 5
|
||||
videoUrl: ''
|
||||
forumTopicId: 302269
|
||||
dashedName: fibonacci-word
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
<p>编写一个函数将Fibonacci字返回到N.N将作为参数提供给函数。该函数应返回一个对象数组。对象的形式应为:{N:1,长度:1,熵:0,单词:'1'}。更多细节如下: </p><p> Fibonacci Word可以类似于Fibonacci Sequence的方式创建, <a href='http://hal.archives-ouvertes.fr/docs/00/36/79/72/PDF/The_Fibonacci_word_fractal.pdf' title='链接:http://hal.archives-ouvertes.fr/docs/00/36/79/72/PDF/The_Fibonacci_word_fractal.pdf'>如下所述</a> : </p><p>将F_Word <sub>1</sub>定义为1 </p><p>将F_Word <sub>2</sub>定义为0 </p><p>将F_Word <sub>3表示</sub>为F_Word <sub>2</sub>与F_Word <sub>1</sub>连接,即:01 </p><p>将F_Word <sub>n表示</sub>为F_Word <sub>n-1</sub>与F_word <sub>n-2连接</sub> </p>
|
||||
The Fibonacci Word may be created in a manner analogous to the Fibonacci Sequence [as described here](https://hal.archives-ouvertes.fr/docs/00/36/79/72/PDF/The_Fibonacci_word_fractal.pdf):
|
||||
|
||||
<pre>Define F_Word<sub>1</sub> as <strong>1</strong>
|
||||
Define F_Word<sub>2</sub> as <strong>0</strong>
|
||||
Form F_Word<sub>3</sub> as F_Word<sub>2</sub> concatenated with F_Word<sub>1</sub> i.e.: <strong>01</strong>
|
||||
Form F_Word<sub>n</sub> as F_Word<sub>n-1</sub> concatenated with F_word<sub>n-2</sub>
|
||||
</pre>
|
||||
|
||||
# --instructions--
|
||||
|
||||
Write a function to return the Fibonacci Words up to `n`. `n` will be provided as a parameter to the function. The function should return an array of objects. The objects should be of the form: `{ N: 1, Length: 1, Entropy: 0, Word: '1' }`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`fibWord`是一个功能。
|
||||
`fibWord` should be a function.
|
||||
|
||||
```js
|
||||
assert(typeof fibWord === 'function');
|
||||
```
|
||||
|
||||
`fibWord(5)`应该返回一个数组。
|
||||
`fibWord(5)` should return an array.
|
||||
|
||||
```js
|
||||
assert(Array.isArray(fibWord(5)));
|
||||
```
|
||||
|
||||
`fibWord(5)`应该返回`'+JSON.stringify(ans)+'` 。
|
||||
`fibWord(5)` should return `[{ N:1, Length:1, Entropy:0, Word:"1" },{ N:2, Length:1, Entropy:0, Word:"0" },{ N:3, Length:2, Entropy:1, Word:"01" },{ N:4, Length:3, Entropy:0.9182958340544896, Word:"010" },{ N:5, Length:5, Entropy:0.9709505944546688, Word:"01001" }]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(fibWord(5), ans);
|
||||
|
Reference in New Issue
Block a user