# 此条规则来自 Wikipedia:
+# This rules file is extracted from Wikipedia:
# http://en.wikipedia.org/wiki/Markov_Algorithm
A -> apple
B -> bag
S -> shop
T -> the
the shop -> my brother
-(终止规则) -> .
+a never used -> .terminating rule
-对于这段文本:
+Sample text of:
`I bought a B of As from T S.`
-应该输出:
+Should generate the output:
`I bought a bag of apples from my brother.`
-**规则集 2:**
+**Ruleset 2:**
-终止规则的测试
+A test of the terminating rule
-# 基于 Wikipedia 的规则稍做修改
+# Slightly modified from the rules on Wikipedia
A -> apple
B -> bag
S -> .shop
T -> the
the shop -> my brother
-(终止规则) -> .
+a never used -> .terminating rule
-对于这段文本:
+Sample text of:
`I bought a B of As from T S.`
-应该输出:
+Should generate:
`I bought a bag of apples from T shop.`
-**规则集 3:**
+**Ruleset 3:**
-这条不仅可以用来测试替换顺序是否正确,还可以测试你的代码中对正则表达式的处理是否完备。如果你的代码没有对正则表达式进行正确的转义处理,那在替换的时候就会出现问题。
+This tests for correct substitution order and may trap simple regexp based replacement routines if special regexp characters are not escaped.
# BNF Syntax testing rules
A -> apple
@@ -85,31 +83,32 @@ W -> WW
S -> .shop
T -> the
the shop -> my brother
-(终止规则) -> .
+a never used -> .terminating rule
-对于这段文本:
+Sample text of:
`I bought a B of As W my Bgage from T S.`
-应该输出:
+Should generate:
-`I bought a bag of apples with my money from T shop.`
+`I bought a bag of apples with my money from T shop.`
-**规则集 4:**
+**Ruleset 4:**
-这条是用来测试规则扫描的顺序是否正确,并可能捕获以错误顺序扫描的替换例程。这里我们选取了通用的一元乘法引擎(请注意,在此实现中,输入的表达式必须放在两个下划线之间)。
+This tests for correct order of scanning of rules, and may trap replacement routines that scan in the wrong order. It implements a general unary multiplication engine. (Note that the input expression must be placed within underscores in this implementation.)
- ##一元乘法引擎,用于测试马尔可夫算法实现
-### by Donal Fellows
-# 一元加法引擎
+### Unary Multiplication Engine, for testing Markov Algorithm implementations
+### By Donal Fellows.
+# Unary addition engine
_+1 -> _1+
1+1 -> 11+
-# 将乘法转换为普通加法
+# Pass for converting from the splitting of multiplication into ordinary
+# addition
1! -> !1
,! -> !+
_! -> _
-# 一元乘法,左侧为被乘数,右侧为乘数
+# Unary multiplication by duplicating left side, right side times
1*1 -> x,@y
1x -> xX
X, -> 1,1
@@ -118,91 +117,94 @@ _x -> _X
,x -> ,X
y1 -> 1y
y_ -> _
-# 下一阶段
+# Next phase of applying
1@1 -> x,@y
1@_ -> @_
,@_ -> !_
++ -> +
-# 加法的终止条件
+# Termination cleanup for addition
_1 -> 1
1+_ -> 1
_+_ ->
-对于这段文本:
+Sample text of:
`_1111*11111_`
-应该输出:
+should generate the output:
`11111111111111111111`
-**规则集5:**
+**Ruleset 5:**
-一台简单的[图灵机](http://en.wikipedia.org/wiki/Turing_machine)包含三个状态的["忙碌海狸"](http://en.wikipedia.org/wiki/Busy_beaver)。纸带由 0 和 1 组成,状态为 A、B、C 和代表终止(Halt)的 H。通过在字符前写状态字母来的方式来指示读写头的位置。机器运行时需要的初始纸带必须通过输入在一开始全部给出。
+A simple [Turing machine](http://en.wikipedia.org/wiki/Turing_machine "link: http://en.wikipedia.org/wiki/Turing_machine"), implementing a three-state [busy beaver](http://en.wikipedia.org/wiki/Busy_beaver "link: http://en.wikipedia.org/wiki/Busy_beaver").
-这一规则集除了可以证明 Markov 算法是图灵完备的,它还帮我找出了使用 C++ 完成此题中的一个错误,而且这个错误没有被前四个规则集抓到。
+The tape consists of `0`s and `1`s, the states are `A`, `B`, `C` and `H` (for `H`alt), and the head position is indicated by writing the state letter before the character where the head is. All parts of the initial tape the machine operates on have to be given in the input.
-# 图灵机:三个状态的"忙碌海狸"
-# 状态 A,符号 0 => 写入 1,向右移动,新状态 B
+Besides demonstrating that the Markov algorithm is Turing-complete, it also made me catch a bug in the C++ implementation which wasn't caught by the first four rulesets.
+
+# Turing machine: three-state busy beaver
+#
+# state A, symbol 0 => write 1, move right, new state B
A0 -> 1B
-# 状态 A,符号 1 => 写入 1,向左移动,新状态 C
+# state A, symbol 1 => write 1, move left, new state C
0A1 -> C01
1A1 -> C11
-# 状态 B,符号 0 => 写入 1,向左移动,新状态 A
+# state B, symbol 0 => write 1, move left, new state A
0B0 -> A01
1B0 -> A11
-# 状态 B,符号 1 => 写入 1,向右移动,新状态 B
-B1 - > 1B
-# 状态 C,符号 0 => 写入 1,向左移动,新状态 B
-0C0 - > B01
-1C0 - > B11
-# 状态 C,符号 1 => 写入 1,向左移动,停止
-0C1 - > H01
-1C1 - > H11
+# state B, symbol 1 => write 1, move right, new state B
+B1 -> 1B
+# state C, symbol 0 => write 1, move left, new state B
+0C0 -> B01
+1C0 -> B11
+# state C, symbol 1 => write 1, move left, halt
+0C1 -> H01
+1C1 -> H11
-这个规则集应将这段输入:
+This ruleset should turn
-`000000A000000`
+`000000A000000`
-转换成:
+into
`00011H1111000`
# --hints--
-`markov` 应是一个函数。
+`markov` should be a function.
```js
assert(typeof markov === 'function');
```
-`markov(["A -> apple","B -> bag","S -> shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")` 应返回 "I bought a bag of apples from my brother."。
+`markov(["A -> apple","B -> bag","S -> shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")` should return "I bought a bag of apples from my brother.".
```js
assert.deepEqual(markov(rules[0], tests[0]), outputs[0]);
```
-`markov(["A -> apple","B -> bag","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")` 应返回 "I bought a bag of apples from T shop."。
+`markov(["A -> apple","B -> bag","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")` should return "I bought a bag of apples from T shop.".
```js
assert.deepEqual(markov(rules[1], tests[1]), outputs[1]);
```
-`markov(["A -> apple","WWWW -> with","Bgage -> ->.*","B -> bag","->.* -> money","W -> WW","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As W my Bgage from T S.")` 应返回 "I bought a bag of apples with my money from T shop."。
+`markov(["A -> apple","WWWW -> with","Bgage -> ->.*","B -> bag","->.* -> money","W -> WW","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As W my Bgage from T S.")` should return "I bought a bag of apples with my money from T shop.".
```js
assert.deepEqual(markov(rules[2], tests[2]), outputs[2]);
```
-`markov(["_+1 -> _1+","1+1 -> 11+","1! -> !1",",! -> !+","_! -> _","1*1 -> x,@y","1x -> xX","X, -> 1,1","X1 -> 1X","_x -> _X",",x -> ,X","y1 -> 1y","y_ -> _","1@1 -> x,@y","1@_ -> @_",",@_ -> !_","++ -> +","_1 -> 1","1+_ -> 1","_+_ -> "],"_1111*11111_")` 应返回 "11111111111111111111"。
+`markov(["_+1 -> _1+","1+1 -> 11+","1! -> !1",",! -> !+","_! -> _","1*1 -> x,@y","1x -> xX","X, -> 1,1","X1 -> 1X","_x -> _X",",x -> ,X","y1 -> 1y","y_ -> _","1@1 -> x,@y","1@_ -> @_",",@_ -> !_","++ -> +","_1 -> 1","1+_ -> 1","_+_ -> "],"_1111*11111_")` should return "11111111111111111111".
```js
assert.deepEqual(markov(rules[3], tests[3]), outputs[3]);
```
-`markov(["A0 -> 1B","0A1 -> C01","1A1 -> C11","0B0 -> A01","1B0 -> A11","B1 -> 1B","0C0 -> B01","1C0 -> B11","0C1 -> H01","1C1 -> H11"],"")` 应返回 "00011H1111000"。
+`markov(["A0 -> 1B","0A1 -> C01","1A1 -> C11","0B0 -> A01","1B0 -> A11","B1 -> 1B","0C0 -> B01","1C0 -> B11","0C1 -> H01","1C1 -> H11"],"")` should return "00011H1111000".
```js
assert.deepEqual(markov(rules[4], tests[4]), outputs[4]);
@@ -210,6 +212,29 @@ assert.deepEqual(markov(rules[4], tests[4]), outputs[4]);
# --seed--
+## --after-user-code--
+
+```js
+
+let rules=[["A -> apple","B -> bag","S -> shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],
+ ["A -> apple","B -> bag","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],
+ ["A -> apple","WWWW -> with","Bgage -> ->.*","B -> bag","->.* -> money","W -> WW","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],
+ ["_+1 -> _1+","1+1 -> 11+","1! -> !1",",! -> !+","_! -> _","1*1 -> x,@y","1x -> xX","X, -> 1,1","X1 -> 1X","_x -> _X",",x -> ,X","y1 -> 1y","y_ -> _","1@1 -> x,@y","1@_ -> @_",",@_ -> !_","++ -> +","_1 -> 1","1+_ -> 1","_+_ -> "],
+ ["A0 -> 1B","0A1 -> C01","1A1 -> C11","0B0 -> A01","1B0 -> A11","B1 -> 1B","0C0 -> B01","1C0 -> B11","0C1 -> H01","1C1 -> H11"]];
+let tests=["I bought a B of As from T S.",
+ "I bought a B of As from T S.",
+ "I bought a B of As W my Bgage from T S.",
+ "_1111*11111_",
+ "000000A000000"];
+let outputs=["I bought a bag of apples from my brother.",
+ "I bought a bag of apples from T shop.",
+ "I bought a bag of apples with my money from T shop.",
+ "11111111111111111111",
+ "00011H1111000"]
+
+```
+
+
## --seed-contents--
```js
@@ -248,21 +273,4 @@ function markov(rules,test) {
}
return test;
}
-
-// tail:
-let rules=[["A -> apple","B -> bag","S -> shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],
- ["A -> apple","B -> bag","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],
- ["A -> apple","WWWW -> with","Bgage -> ->.*","B -> bag","->.* -> money","W -> WW","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],
- ["_+1 -> _1+","1+1 -> 11+","1! -> !1",",! -> !+","_! -> _","1*1 -> x,@y","1x -> xX","X, -> 1,1","X1 -> 1X","_x -> _X",",x -> ,X","y1 -> 1y","y_ -> _","1@1 -> x,@y","1@_ -> @_",",@_ -> !_","++ -> +","_1 -> 1","1+_ -> 1","_+_ -> "],
- ["A0 -> 1B","0A1 -> C01","1A1 -> C11","0B0 -> A01","1B0 -> A11","B1 -> 1B","0C0 -> B01","1C0 -> B11","0C1 -> H01","1C1 -> H11"]];
-let tests=["I bought a B of As from T S.",
- "I bought a B of As from T S.",
- "I bought a B of As W my Bgage from T S.",
- "_1111*11111_",
- "000000A000000"];
-let outputs=["I bought a bag of apples from my brother.",
- "I bought a bag of apples from T shop.",
- "I bought a bag of apples with my money from T shop.",
- "11111111111111111111",
- "00011H1111000"];
```
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/execute-brain.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/execute-brain.md
index 802f929b944..7504589e582 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/execute-brain.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/execute-brain.md
@@ -1,42 +1,61 @@
---
id: 59e0a8df964e4540d5abe599
-title: 执行大脑****
+title: Execute Brain****
challengeType: 5
-videoUrl: ''
+forumTopicId: 302261
dashedName: execute-brain
---
# --description--
-编写一个函数来实现Brain ****解释器。该函数将字符串作为参数,并应返回一个字符串作为输出。更多细节如下:
RCBF是一套为各种语言的Rosetta Code编写的Brainf ***编译器和解释器。
以下是RCBF每个版本的链接。
实现只需要正确实现以下指令:
{|
!命令
!描述
| -
|风格=“文本对齐:中心” | > ||将指针向右移动
| -
|风格=“文本对齐:中心” | < ||将指针移到左侧
| -
|风格=“文本对齐:中心” | + ||增加指针下的内存单元格
| -
|风格=“文本对齐:中心” | - ||减少指针下的内存单元格
| -
|风格=“文本对齐:中心” | . ||输出指针处单元格表示的字符
| -
|风格=“文本对齐:中心” | , ||输入一个字符并将其存储在指针的单元格中
| -
|风格=“文本对齐:中心” | [ ||如果指针下的单元格为0,则跳过匹配]
| -
|风格=“文本对齐:中心” | ] ||跳回匹配[如果指针下的单元格非零
|}
允许任何单元格大小,EOF( E nd- O - F ile)支持是可选的,无论您是否有有界或无界内存。
+Write a function to implement a Brain\*\*\*\* interpreter. The function will take a string as a parameter and should return a string as the output. More details are given below:
+
+RCBF is a set of [Brainf\*\*\*](https://rosettacode.org/wiki/Brainf*** "Brainf\*\*\*") compilers and interpreters written for Rosetta Code in a variety of languages.
+
+Below are links to each of the versions of RCBF.
+
+An implementation need only properly implement the following instructions:
+
+| Command | Description |
+| ------------------------- | ------------------------------------------------------------------------------------------ |
+| > | Move the pointer to the right |
+| < | Move the pointer to the left |
+| + | Increment the memory cell under the pointer |
+| - | Decrement the memory cell under the pointer |
+| . | Output the character signified by the cell at the pointer |
+| , | Input a character and store it in the cell at the pointer |
+| \[ | Jump past the matching ] if the cell under the pointer is 0 |
+| ] | Jump back to the matching \[ if the cell under the pointer is nonzero |
+
+Any cell size is allowed, EOF (*E*nd-*O*-*F*ile) support is optional, as is whether you have bounded or unbounded memory.
# --hints--
-`brain(bye)`应该重新调整一个字符串
+`brain(bye)` should return a string
```js
assert(typeof brain(bye) === 'string');
```
-brain("++++++[>++++++++++<-]>+++++.")</code should return "A"
+`brain("++++++[>++++++++++<-]>+++++.")` should return "A"
```js
assert.equal(brain('++++++[>++++++++++<-]>+++++.'), 'A');
```
-`brain(bye)`应该回归`Goodbye, World!\\r\\n`
+`brain(bye)` should return `Goodbye, World!\r\n`
```js
assert.equal(brain(bye), 'Goodbye, World!\r\n');
```
-`brain(hello)`应该回归`Hello World!\\n`
+`brain(hello)` should return `Hello World!\n`
```js
assert.equal(brain(hello), 'Hello World!\n');
```
-`brain(fib)`应该返回`1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89`
+`brain(fib)` should return `1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89`
```js
assert.equal(brain(fib), '1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89');
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/extensible-prime-generator.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/extensible-prime-generator.md
index d37956690b5..620da453ffe 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/extensible-prime-generator.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/extensible-prime-generator.md
@@ -1,24 +1,35 @@
---
id: 598ee8b91b410510ae82efef
-title: 可扩展的素发生器
+title: Extensible prime generator
challengeType: 5
-videoUrl: ''
+forumTopicId: 302262
dashedName: extensible-prime-generator
---
# --description--
-按顺序编写素数生成器,它将自动调整以适应任何合理高素数的生成。
发电机应能:显示前N个黄金numbers.Show在range.Show的素数的素数在range.Show数第 n 个素数。 该函数应该有两个参数。第一个将接收n或作为数组的范围。第二个将接收一个布尔值,它指定函数是否将素数作为数组或单个数字(范围中的素数或第n 个素数)返回。根据参数,函数应该返回一个数组。
+Write a generator of prime numbers, in order, that will automatically adjust to accommodate the generation of any reasonably high prime.
+
+The generator should be able to:
+
+
+ - Show the first
n prime numbers
+ - Show the prime numbers in a range
+ - Show the number of primes in a range
+ - Show the
nth prime number
+
+
+The function should have two parameters. The first will receive `n` or the range as an array. The second will receive a boolean, that specifies if the function returns the prime numbers as an array or a single number(the number of primes in the range or the nth prime). According to the parameters the function should return an array.
# --hints--
-`primeGenerator`是一个函数。
+`primeGenerator` should be a function.
```js
assert(typeof primeGenerator === 'function');
```
-`primeGenerator`是一个函数。
+`primeGenerator(20, true)` should return `[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]`.
```js
assert.deepEqual(primeGenerator(20, true), [
@@ -45,7 +56,7 @@ assert.deepEqual(primeGenerator(20, true), [
]);
```
-`primeGenerator`是一个函数。
+`primeGenerator([100, 150], true)` should return `[101, 103, 107, 109, 113, 127, 131, 137, 139, 149]`.
```js
assert.deepEqual(primeGenerator([100, 150], true), [
@@ -62,13 +73,13 @@ assert.deepEqual(primeGenerator([100, 150], true), [
]);
```
-`primeGenerator`是一个函数。
+`primeGenerator([7700, 8000], false)` should return `30`.
```js
assert.equal(primeGenerator([7700, 8000], false), 30);
```
-`primeGenerator`是一个函数。
+`primeGenerator(10000, false)` should return `104729`.
```js
assert.equal(primeGenerator(10000, false), 104729);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/factorial.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/factorial.md
index 84b89ffce25..f58bdffe25e 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/factorial.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/factorial.md
@@ -1,42 +1,56 @@
---
id: 597b2b2a2702b44414742771
-title: 阶乘
+title: Factorial
challengeType: 5
-videoUrl: ''
+forumTopicId: 302263
dashedName: factorial
---
# --description--
-编写一个函数来返回一个数字的阶乘。
一个数字的因子由下式给出:
N! = n \*(n-1)\*(n-2)\* ..... \* 1 例如:3! = 3 * 2 * 1 = 6 4! = 4 * 3 * 2 * 1 = 24
注意:0! = 1
+Write a function to return the factorial of a number.
+
+Factorial of a number is given by:
+
+n! = n * (n-1) * (n-2) * ..... * 1
+
+
+For example:
+
+
+ 3! = 3 * 2 * 1 = 6
+ 4! = 4 * 3 * 2 * 1 = 24
+
+
+**Note:** `0! = 1`
# --hints--
-`factorial`是一种功能。
+`factorial` should be a function.
```js
assert(typeof factorial === 'function');
```
-`factorial(2)`应该返回一个数字。
+`factorial(2)` should return a number.
```js
assert(typeof factorial(2) === 'number');
```
-`factorial(3)`应该返回6.“)
+`factorial(3)` should return 6.
```js
assert.equal(factorial(3), 6);
```
-`factorial(3)`应返回120.“)
+`factorial(5)` should return 120.
```js
assert.equal(factorial(5), 120);
```
-`factorial(3)`应返回3,628,800。“)
+`factorial(10)` should return 3,628,800.
```js
assert.equal(factorial(10), 3628800);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md
index 9f72beb2b3f..f450b13ddbe 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.md
@@ -1,42 +1,88 @@
---
id: 598eea87e5cf4b116c3ff81a
-title: 梅森数的因素
+title: Factors of a Mersenne number
challengeType: 5
-videoUrl: ''
+forumTopicId: 302264
dashedName: factors-of-a-mersenne-number
---
# --description--
-梅森数是2 P -1形式的数字。
如果P是素数,那么梅森数可能是梅森素数
(如果P不是素数,则梅森数也不是素数)。
在搜索梅森素数时,通过在开始可能冗长的Lucas-Lehmer检验之前找到一个小因子来消除指数是有利的。
有非常有效的算法来确定数字是否除以2 P -1(或等效地,如果2 P mod(数字)= 1)。
有些语言已经有了这个exponent-and-mod操作的内置实现(称为modPow或类似的)。
以下是如何自己实现这个modPow:
例如,让我们计算2 23 mod 47。
将指数23转换为二进制,得到10111.从square = 1开始,重复平方。
卸下指数的最高位,并且如果它是1 平方乘以由所述幂(2)的基础上,然后计算平方模47。
在下一步中使用最后一步的模数结果作为square的初始值:
删除可选
方形顶部位乘以2 mod 47
------------ ------- ------------- ------
1 * 1 = 1 1 0111 1 * 2 = 2 2
2 * 2 = 4 0 111否4
4 * 4 = 16 1 11 16 * 2 = 32 32
32 * 32 = 1024 1 1 1024 * 2 = 2048 27
27 * 27 = 729 1 729 * 2 = 1458 1
由于2 23 mod 47 = 1,47是2 P -1的因子。
(要看到这一点,从两边减去1:2 23 -1 = 0 mod 47.)
由于我们已经证明47是一个因子,因此2 23 -1不是素数。
Mersenne数字的其他属性使我们能够进一步完善这一过程。
任何因子q为2 P -1必须是2kP + 1的形式,k是正整数或零。此外,q必须是1或7 mod 8。
最后任何潜在因素q必须是素数 。
与其他试验划分算法一样,算法在2kP + 1> sqrt(N)时停止。
这些素性测试仅适用于P为素数的Mersenne数。例如,M 4 = 15不使用这些技术产生因子,而是产生3和5的因子,两者都不符合2kP + 1。
任务: 使用上述方法找到因子2 929 -1(又名M929)
相关任务: 计数因素 素数分解 的整数的因素 埃拉托塞尼的筛 通过试验除法素性 梅森数的试验理 分区的整数X为N个素数 由审判庭素数的序列 在1948年计算机:2¹²⁷-1
+A Mersenne number is a number in the form of 2P-1.
+
+If `P` is prime, the Mersenne number may be a Mersenne prime. (If `P` is not prime, the Mersenne number is also not prime.)
+
+In the search for Mersenne prime numbers it is advantageous to eliminate exponents by finding a small factor before starting a, potentially lengthy, [Lucas-Lehmer test](https://rosettacode.org/wiki/Lucas-Lehmer test "Lucas-Lehmer test").
+
+There are very efficient algorithms for determining if a number divides 2P-1 (or equivalently, if 2P mod (the number) = 1).
+
+Some languages already have built-in implementations of this exponent-and-mod operation (called modPow or similar).
+
+The following is how to implement this modPow yourself:
+
+For example, let's compute 223 mod 47.
+
+Convert the exponent 23 to binary, you get 10111. Starting with square = 1, repeatedly square it.
+
+Remove the top bit of the exponent, and if it's 1 multiply `square` by the base of the exponentiation (2), then compute square modulo 47.
+
+Use the result of the modulo from the last step as the initial value of `square` in the next step:
+
+Remove Optional
+square top bit multiply by 2 mod 47
+------------ ------- ------------- ------
+1*1 = 1 1 0111 1*2 = 2 2
+2*2 = 4 0 111 no 4
+4*4 = 16 1 11 16*2 = 32 32
+32*32 = 1024 1 1 1024*2 = 2048 27
+27*27 = 729 1 729*2 = 1458 1
+
+
+Since 223 mod 47 = 1, 47 is a factor of 2P-1.
+
+(To see this, subtract 1 from both sides: 223-1 = 0 mod 47.)
+
+Since we've shown that 47 is a factor, 223-1 is not prime.
+
+Further properties of Mersenne numbers allow us to refine the process even more.
+
+Any factor `q` of 2P-1 must be of the form `2kP+1`, `k` being a positive integer or zero. Furthermore, `q` must be `1` or `7 mod 8`.
+
+Finally any potential factor `q` must be [prime](https://rosettacode.org/wiki/Primality by Trial Division "Primality by Trial Division").
+
+As in other trial division algorithms, the algorithm stops when `2kP+1 > sqrt(N)`.These primarily tests only work on Mersenne numbers where `P` is prime. For example, M4=15 yields no factors using these techniques, but factors into 3 and 5, neither of which fit `2kP+1`.
+
+# --instructions--
+
+Using the above method find a factor of 2929-1 (aka M929)
# --hints--
-`check_mersenne`是一个函数。
+`check_mersenne` should be a function.
```js
assert(typeof check_mersenne === 'function');
```
-`check_mersenne(3)`应该返回一个字符串。
+`check_mersenne(3)` should return a string.
```js
assert(typeof check_mersenne(3) == 'string');
```
-`check_mersenne(3)`应该返回“M3 = 2 ^ 3-1是素数”。
+`check_mersenne(3)` should return "M3 = 2^3-1 is prime".
```js
assert.equal(check_mersenne(3), 'M3 = 2^3-1 is prime');
```
-`check_mersenne(23)`应返回“M23 = 2 ^ 23-1与因子47复合”。
+`check_mersenne(23)` should return "M23 = 2^23-1 is composite with factor 47".
```js
assert.equal(check_mersenne(23), 'M23 = 2^23-1 is composite with factor 47');
```
-`check_mersenne(929)`应返回“M929 = 2 ^ 929-1与因子13007复合
+`check_mersenne(929)` should return "M929 = 2^929-1 is composite with factor 13007
```js
assert.equal(
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/factors-of-an-integer.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/factors-of-an-integer.md
index 12dcf06644b..31d9b722b7f 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/factors-of-an-integer.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/factors-of-an-integer.md
@@ -1,36 +1,38 @@
---
id: 597f1e7fbc206f0e9ba95dc4
-title: 整数因子
+title: Factors of an integer
challengeType: 5
-videoUrl: ''
+forumTopicId: 302265
dashedName: factors-of-an-integer
---
# --description--
-编写一个返回正整数因子的函数。
这些因子是正整数,通过该正整数可以将被分解的数量除以产生正整数结果。
///
+Write a function that returns the factors of a positive integer as an array.
+
+These factors are the positive integers by which the number being factored can be divided to yield a positive integer result.
# --hints--
-`factors`是一种功能。
+`factors` should be a function.
```js
assert(typeof factors === 'function');
```
-`factors(45)`应该返回`[1,3,5,9,15,45]` 。
+`factors(45)` should return `[1,3,5,9,15,45]`.
```js
assert.deepEqual(factors(45), ans[0]);
```
-`factors(53)`应该返回`[1,53]` 。
+`factors(53)` should return `[1,53]`.
```js
assert.deepEqual(factors(53), ans[1]);
```
-`factors(64)`应该返回`[1,2,4,8,16,32,64]` 。
+`factors(64)` should return `[1,2,4,8,16,32,64]`.
```js
assert.deepEqual(factors(64), ans[2]);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/farey-sequence.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/farey-sequence.md
index 2641088dd2d..59b4edc9a54 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/farey-sequence.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/farey-sequence.md
@@ -1,42 +1,65 @@
---
id: 59c3ec9f15068017c96eb8a3
-title: Farey序列
+title: Farey sequence
challengeType: 5
-videoUrl: ''
+forumTopicId: 302266
dashedName: farey-sequence
---
# --description--
-编写一个返回n阶Farey序列的函数。该函数应该有一个参数n。它应该将序列作为数组返回。阅读以下内容了解更多详情:
阶数n的Farey序列 F n是在0和1之间的完全减少的分数的序列,当在最低阶段时,具有小于或等于n的分母,按照增大的大小排列。
Farey序列有时被错误地称为Farey系列。
每个Farey序列:
:: *以值0开头,由分数$ \ frac {0} {1} $表示
:: *以值1结尾,由$ \ frac {1} {1} $分数表示。
订单1到5的Farey序列是:
$ {\ bf \ it {F}} _ 1 = \ frac {0} {1},\ frac {1} {1} $
$ {\ bf \ it {F}} _ 2 = \ frac {0} {1},\ frac {1} {2},\ frac {1} {1} $
$ {\ bf \ it {F}} _ 3 = \ frac {0} {1},\ frac {1} {3},\ frac {1} {2},\ frac {2} {3},\ frac {1} {1} $
$ {\ bf \ it {F}} _ 4 = \ frac {0} {1},\ frac {1} {4},\ frac {1} {3},\ frac {1} {2},\ frac {2} {3},\ frac {3} {4},\ frac {1} {1} $
$ {\ bf \ it {F}} _ 5 = \ frac {0} {1},\ frac {1} {5},\ frac {1} {4},\ frac {1} {3},\ frac {2} {5},\ frac {1} {2},\ frac {3} {5},\ frac {2} {3},\ frac {3} {4},\ frac {4} {5 },\ frac {1} {1} $
+The [Farey sequence](https://en.wikipedia.org/wiki/Farey sequence "wp: Farey sequence") Fn of order `n` is the sequence of completely reduced fractions between `0` and `1` which, when in lowest terms, have denominators less than or equal to `n`, arranged in order of increasing size.
+
+The *Farey sequence* is sometimes incorrectly called a *Farey series*.
+
+Each Farey sequence:
+
+
+ - starts with the value 0, denoted by the fraction $ \frac{0}{1} $
+ - ends with the value 1, denoted by the fraction $ \frac{1}{1}$.
+
+
+The Farey sequences of orders `1` to `5` are:
+
+
+ - ${\bf\it{F}}_1 = \frac{0}{1}, \frac{1}{1}$
+ - ${\bf\it{F}}_2 = \frac{0}{1}, \frac{1}{2}, \frac{1}{1}$
+ - ${\bf\it{F}}_3 = \frac{0}{1}, \frac{1}{3}, \frac{1}{2}, \frac{2}{3}, \frac{1}{1}$
+ - ${\bf\it{F}}_4 = \frac{0}{1}, \frac{1}{4}, \frac{1}{3}, \frac{1}{2}, \frac{2}{3}, \frac{3}{4}, \frac{1}{1}$
+ - ${\bf\it{F}}_5 = \frac{0}{1}, \frac{1}{5}, \frac{1}{4}, \frac{1}{3}, \frac{2}{5}, \frac{1}{2}, \frac{3}{5}, \frac{2}{3}, \frac{3}{4}, \frac{4}{5}, \frac{1}{1}$
+
+
+# --instructions--
+
+Write a function that returns the Farey sequence of order `n`. The function should have one parameter that is `n`. It should return the sequence as an array.
# --hints--
-`farey`是一种功能。
+`farey` should be a function.
```js
assert(typeof farey === 'function');
```
-`farey(3)`应该返回一个数组
+`farey(3)` should return an array
```js
assert(Array.isArray(farey(3)));
```
-`farey(3)`应该返回`["1/3","1/2","2/3"]`
+`farey(3)` should return `["1/3","1/2","2/3"]`
```js
assert.deepEqual(farey(3), ['1/3', '1/2', '2/3']);
```
-`farey(4)`应该返回`["1/4","1/3","1/2","2/4","2/3","3/4"]`
+`farey(4)` should return `["1/4","1/3","1/2","2/4","2/3","3/4"]`
```js
assert.deepEqual(farey(4), ['1/4', '1/3', '1/2', '2/4', '2/3', '3/4']);
```
-`farey(5)`应返回`["1/5","1/4","1/3","2/5","1/2","2/4","3/5","2/3","3/4","4/5"]`
+`farey(5)` should return `["1/5","1/4","1/3","2/5","1/2","2/4","3/5","2/3","3/4","4/5"]`
```js
assert.deepEqual(farey(5), [
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences.md
index 03c846f96fe..456b87de792 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences.md
@@ -1,60 +1,89 @@
---
id: 598eef80ba501f1268170e1e
-title: 斐波那契n步数序列
+title: Fibonacci n-step number sequences
challengeType: 5
-videoUrl: ''
+forumTopicId: 302267
dashedName: fibonacci-n-step-number-sequences
---
# --description--
-编写一个函数来生成Fibonacci n步数序列和Lucas序列。第一个参数是n。第二个参数是要返回的元素数。第三个参数将指定是输出Fibonacci序列还是Lucas序列。如果参数为“f”,则返回Fibonacci序列,如果为“l”,则返回Lucas序列。序列必须作为数组返回。更多细节如下:
这些数字序列是普通斐波纳契数列的扩展,其中:
对于$ n = 2 $,我们有Fibonacci序列;初始值$ \[1,1] $和$ F_k ^ 2 = F\_ {k-1} ^ 2 + F\_ {k-2} ^ 2 $对于$ n = 3 $,我们有tribonacci序列;初始值$ \[1,1,2] $和$ F_k ^ 3 = F\_ {k-1} ^ 3 + F\_ {k-2} ^ 3 + F\_ {k-3} ^ 3 $ $ $ = 4 $我们有tetranacci序列;初始值$ \[1,1,2,4] $和$ F_k ^ 4 = F\_ {k-1} ^ 4 + F\_ {k-2} ^ 4 + F\_ {k-3} ^ 4 + F\_ {k -4} ^ 4 $ ...对于一般的$ n> 2 $,我们有斐波那契$ n $ -step序列 - $ F_k ^ n $; $(n-1)$'斐波那契$ n $ -step序列$ F_k ^ {n-1} $的前$ n $值的初始值;和$ k $'这个$ n $'序列的值是$ F_k ^ n = \\ sum\_ {i = 1} ^ {(n)} {F\_ {ki} ^ {(n)}} $ 对于$ n $的小值, 希腊数字前缀有时用于单独命名每个系列。
{| style =“text-align:left;” border =“4”cellpadding =“2”cellspacing =“2”
| + Fibonacci $ n $ -step序列
| - style =“background-color:rgb(255,204,255);”
! $ n $ !!系列名称!!值
| -
| 2 ||斐波那契|| 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 ......
| -
| 3 || tribonacci || 1 1 2 4 7 13 24 44 81 149 274 504 927 1705 3136 ......
| -
| 4 || tetranacci || 1 1 2 4 8 15 29 56 108 208 401 773 1490 2872 5536 ......
| -
| 5 || pentanacci || 1 1 2 4 8 16 31 61 120 236 464 912 1793 3525 6930 ......
| -
| 6 || hexanacci || 1 1 2 4 8 16 32 63 125 248 492 976 1936 3840 7617 ......
| -
| 7 || heptanacci || 1 1 2 4 8 16 32 64 127 253 504 1004 2000 3984 7936 ......
| -
| 8 || octonacci || 1 1 2 4 8 16 32 64 128 255 509 1016 2028 4048 8080 ...
| -
| 9 || nonanacci || 1 1 2 4 8 16 32 64 128 256 511 1021 2040 4076 8144 ......
| -
| 10 || decanacci || 1 1 2 4 8 16 32 64 128 256 512 1023 2045 4088 8172 ...
|}
可以在更改初始值的位置生成联合序列:
Lucas系列将两个前面的值相加,例如$ n = 2 $的斐波那契数列,但使用$ [2,1] $作为其初始值。
+These number series are an expansion of the ordinary [Fibonacci sequence](https://rosettacode.org/wiki/Fibonacci sequence "Fibonacci sequence") where:
+
+
+ - For $n = 2$ we have the Fibonacci sequence; with initial values $[1, 1]$ and $F_k^2 = F_{k-1}^2 + F_{k-2}^2$
+ - For $n = 3$ we have the tribonacci sequence; with initial values $[1, 1, 2]$ and $F_k^3 = F_{k-1}^3 + F_{k-2}^3 + F_{k-3}^3$
+ - For $n = 4$ we have the tetranacci sequence; with initial values $[1, 1, 2, 4]$ and $F_k^4 = F_{k-1}^4 + F_{k-2}^4 + F_{k-3}^4 + F_{k-4}^4$...
+ - For general $n>2$ we have the Fibonacci $n$-step sequence - $F_k^n$; with initial values of the first $n$ values of the $(n-1)$'th Fibonacci $n$-step sequence $F_k^{n-1}$; and $k$'th value of this $n$'th sequence being $F_k^n = \sum_{i=1}^{(n)} {F_{k-i}^{(n)}}$
+
+
+For small values of $n$, [Greek numeric prefixes](https://en.wikipedia.org/wiki/Number prefix#Greek_series "wp: Number prefix#Greek_series") are sometimes used to individually name each series.
+
+Fibonacci $n$-step sequences:
+
+| $n$ | Series name | Values |
+| --- | ----------- | ------------------------------------------------------ |
+| 2 | fibonacci | 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 ... |
+| 3 | tribonacci | 1 1 2 4 7 13 24 44 81 149 274 504 927 1705 3136 ... |
+| 4 | tetranacci | 1 1 2 4 8 15 29 56 108 208 401 773 1490 2872 5536 ... |
+| 5 | pentanacci | 1 1 2 4 8 16 31 61 120 236 464 912 1793 3525 6930 ... |
+| 6 | hexanacci | 1 1 2 4 8 16 32 63 125 248 492 976 1936 3840 7617 ... |
+| 7 | heptanacci | 1 1 2 4 8 16 32 64 127 253 504 1004 2000 3984 7936 ... |
+| 8 | octonacci | 1 1 2 4 8 16 32 64 128 255 509 1016 2028 4048 8080 ... |
+| 9 | nonanacci | 1 1 2 4 8 16 32 64 128 256 511 1021 2040 4076 8144 ... |
+| 10 | decanacci | 1 1 2 4 8 16 32 64 128 256 512 1023 2045 4088 8172 ... |
+
+Allied sequences can be generated where the initial values are changed: The [Lucas series](https://en.wikipedia.org/wiki/Lucas number "wp: Lucas number") sums the two preceding values like the fibonacci series for $n=2$ but uses $\[2, 1]$ as its initial values.
+
+# --instructions--
+
+Write a function to generate Fibonacci $n$-step number sequences and Lucas sequences. The first parameter will be $n$. The second parameter will be the number of elements to be returned. The third parameter will specify whether to output the Fibonacci sequence or the Lucas sequence. If the parameter is `"f"` then return the Fibonacci sequence and if it is `"l"`, then return the Lucas sequence. The sequences must be returned as an array.
# --hints--
-`fib_luc`是一个功能。
+`fib_luc` should be a function.
```js
assert(typeof fib_luc === 'function');
```
-`fib_luc(2,10,"f")`应返回`[1,1,2,3,5,8,13,21,34,55]` 。
+`fib_luc(2,10,"f")` should return `[1,1,2,3,5,8,13,21,34,55]`.
```js
assert.deepEqual(fib_luc(2, 10, 'f'), ans[0]);
```
-`fib_luc(3,15,"f")`应返回`[1,1,2,4,7,13,24,44,81,149,274,504,927,1705,3136]` 。
+`fib_luc(3,15,"f")` should return `[1,1,2,4,7,13,24,44,81,149,274,504,927,1705,3136]`.
```js
assert.deepEqual(fib_luc(3, 15, 'f'), ans[1]);
```
-`fib_luc(4,15,"f")`应返回`[1,1,2,4,8,15,29,56,108,208,401,773,1490,2872,5536]` 。
+`fib_luc(4,15,"f")` should return `[1,1,2,4,8,15,29,56,108,208,401,773,1490,2872,5536]`.
```js
assert.deepEqual(fib_luc(4, 15, 'f'), ans[2]);
```
-`fib_luc(2,10,"l")`应返回`[ 2, 1, 3, 4, 7, 11, 18, 29, 47, 76]` `fib_luc(2,10,"l")` `[ 2, 1, 3, 4, 7, 11, 18, 29, 47, 76]` 。
+`fib_luc(2,10,"l")` should return `[ 2, 1, 3, 4, 7, 11, 18, 29, 47, 76]`.
```js
assert.deepEqual(fib_luc(2, 10, 'l'), ans[3]);
```
-`fib_luc(3,15,"l")`应返回`[ 2, 1, 3, 6, 10, 19, 35, 64, 118, 217, 399, 734, 1350, 2483, 4567 ]` `fib_luc(3,15,"l")` `[ 2, 1, 3, 6, 10, 19, 35, 64, 118, 217, 399, 734, 1350, 2483, 4567 ]` 。
+`fib_luc(3,15,"l")` should return `[ 2, 1, 3, 6, 10, 19, 35, 64, 118, 217, 399, 734, 1350, 2483, 4567 ]`.
```js
assert.deepEqual(fib_luc(3, 15, 'l'), ans[4]);
```
-`fib_luc(4,15,"l")`应该返回`[ 2, 1, 3, 6, 12, 22, 43, 83, 160, 308, 594, 1145, 2207, 4254, 8200 ]` `fib_luc(4,15,"l")` `[ 2, 1, 3, 6, 12, 22, 43, 83, 160, 308, 594, 1145, 2207, 4254, 8200 ]` 。
+`fib_luc(4,15,"l")` should return `[ 2, 1, 3, 6, 12, 22, 43, 83, 160, 308, 594, 1145, 2207, 4254, 8200 ]`.
```js
assert.deepEqual(fib_luc(4, 15, 'l'), ans[5]);
```
-`fib_luc(5,15,"l")`应该返回`[ 2, 1, 3, 6, 12, 24, 46, 91, 179, 352, 692, 1360, 2674, 5257, 10335 ]` 。
+`fib_luc(5,15,"l")` should return `[ 2, 1, 3, 6, 12, 24, 46, 91, 179, 352, 692, 1360, 2674, 5257, 10335 ]`.
```js
assert.deepEqual(fib_luc(5, 15, 'l'), ans[6]);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fibonacci-sequence.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fibonacci-sequence.md
index 5fa1a5e1466..2cce69c1856 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fibonacci-sequence.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fibonacci-sequence.md
@@ -1,45 +1,53 @@
---
id: 597f24c1dda4e70f53c79c81
-title: 斐波那契序列
+title: Fibonacci sequence
challengeType: 5
-videoUrl: ''
+forumTopicId: 302268
dashedName: fibonacci-sequence
---
# --description--
-编写一个函数来生成第n 个 Fibonacci数。
/// 第n 个 Fibonacci数由下式给出:///
F n = F n-1 + F n-2
/// 该系列的前两个术语是0,1。
/// 因此,该系列是:0,1,1,2,3,5,8,13 ......
///
+Write a function to generate the nth Fibonacci number.
+
+The nth Fibonacci number is given by:
+
+Fn = Fn-1 + Fn-2
+
+The first two terms of the series are 0 and 1.
+
+Hence, the series is: 0, 1, 1, 2, 3, 5, 8, 13...
# --hints--
-`fibonacci`是一种功能。
+`fibonacci` should be a function.
```js
assert(typeof fibonacci === 'function');
```
-`fibonacci(2)`应该返回一个数字。
+`fibonacci(2)` should return a number.
```js
assert(typeof fibonacci(2) == 'number');
```
-`fibonacci(3)`应该返回1.“)
+`fibonacci(3)` should return 2.
```js
-assert.equal(fibonacci(3), 1);
+assert.equal(fibonacci(3), 2);
```
-`fibonacci(5)`应该返回3.“)
+`fibonacci(5)` should return 5.
```js
-assert.equal(fibonacci(5), 3);
+assert.equal(fibonacci(5), 5);
```
-`fibonacci(10)`应该返回34.“)
+`fibonacci(10)` should return 55.
```js
-assert.equal(fibonacci(10), 34);
+assert.equal(fibonacci(10), 55);
```
# --seed--
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fibonacci-word.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fibonacci-word.md
index 12a36bc499f..708f743add3 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fibonacci-word.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fibonacci-word.md
@@ -1,30 +1,40 @@
---
id: 5992e222d397f00d21122931
-title: 斐波那契字
+title: Fibonacci word
challengeType: 5
-videoUrl: ''
+forumTopicId: 302269
dashedName: fibonacci-word
---
# --description--
-编写一个函数将Fibonacci字返回到N.N将作为参数提供给函数。该函数应返回一个对象数组。对象的形式应为:{N:1,长度:1,熵:0,单词:'1'}。更多细节如下:
Fibonacci Word可以类似于Fibonacci Sequence的方式创建, 如下所述 :
将F_Word 1定义为1
将F_Word 2定义为0
将F_Word 3表示为F_Word 2与F_Word 1连接,即:01
将F_Word n表示为F_Word n-1与F_word n-2连接
+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):
+
+Define F_Word1 as 1
+Define F_Word2 as 0
+Form F_Word3 as F_Word2 concatenated with F_Word1 i.e.: 01
+Form F_Wordn as F_Wordn-1 concatenated with F_wordn-2
+
+
+# --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);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fractran.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fractran.md
index 79f8f9f7cf7..0bcda09bdec 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fractran.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/fractran.md
@@ -1,54 +1,81 @@
---
id: 5a7dad05be01840e1778a0d1
title: Fractran
-challengeType: 3
-videoUrl: ''
+challengeType: 5
+forumTopicId: 302270
dashedName: fractran
---
# --description--
- FRACTRAN是由数学家John Horton Conway发明的图灵完备的深奥编程语言。
FRACTRAN程序是正分数$ P =(f_1,f_2,\ ldots,f_m)$的有序列表,以及初始正整数输入$ n $。
该程序通过更新整数$ n $来运行,如下所示:
- 对于第一个分数$ f_i $,在$ nf_i $为整数的列表中,用$ nf_i $替换$ n $;
- 重复此规则,直到列表中没有分数乘以$ n $时产生整数,然后停止。
康威为FRACTRAN提供了素数计划:
$ 17/91 $,$ 78/85 $,$ 19/51 $,$ 23/38 $,$ 29/33 $,$ 77/29 $,$ 95/23 $,$ 77/19 $,$ 1/17 $,$ 11/13 $, $ 13/11 $ $,$ 15/14 $,$ 15/2 $,$ 55/1 $
从$ n = 2 $开始,此FRACTRAN程序将$ n $更改为$ 15 = 2 \ times(15/2)$,然后$ 825 = 15 \ times(55/1)$,生成以下整数序列:
$ 2 $,$ 15 $,$ 825 $,$ 725 $,$ 1925 $,$ 2275 $,$ 425 $,$ 390 $,$ 330 $,$ 290 $,$ 770 $,$ \ ldots $
2之后,此序列包含以下2的幂:
$ 2 ^ 2 = 4 $,$ 2 ^ 3 = 8 $,$ 2 ^ 5 = 32 $,$ 2 ^ 7 = 128 $,$ 2 ^ {11} = 2048 $,$ 2 ^ {13} = 8192 $,$ 2 ^ {17 } = 131072 $,$ 2 ^ {19} = 524288 $,$ \ ldots $
这是2的主要权力。
- 任务:
编写一个函数,将fractran程序作为字符串参数,并将程序的前10个数字作为数组返回。如果结果没有10个数字,则按原样返回数字。
+[FRACTRAN](https://en.wikipedia.org/wiki/FRACTRAN "wp: FRACTRAN") is a Turing-complete esoteric programming language invented by the mathematician [John Horton Conway](https://en.wikipedia.org/wiki/John Horton Conway "wp: John Horton Conway").
+
+A FRACTRAN program is an ordered list of positive fractions $P = (f_1, f_2, \\ldots, f_m)$, together with an initial positive integer input $n$.
+
+The program is run by updating the integer $n$ as follows:
+
+
+ - for the first fraction, $f_i$, in the list for which $nf_i$ is an integer, replace $n$ with $nf_i$ ;
+ - repeat this rule until no fraction in the list produces an integer when multiplied by $n$, then halt.
+
+
+Conway gave a program for primes in FRACTRAN:
+
+$\\dfrac{17}{91}$, $\\dfrac{78}{85}$, $\\dfrac{19}{51}$, $\\dfrac{23}{38}$, $\\dfrac{29}{33}$, $\\dfrac{77}{29}$, $\\dfrac{95}{23}$, $\\dfrac{77}{19}$, $\\dfrac{1}{17}$, $\\dfrac{11}{13}$, $\\dfrac{13}{11}$, $\\dfrac{15}{14}$, $\\dfrac{15}{2}$, $\\dfrac{55}{1}$
+
+Starting with $n=2$, this FRACTRAN program will change $n$ to $15=2\\times (\\frac{15}{2})$, then $825=15\\times (\\frac{55}{1})$, generating the following sequence of integers:
+
+$2$, $15$, $825$, $725$, $1925$, $2275$, $425$, $390$, $330$, $290$, $770$, $\\ldots$
+
+After 2, this sequence contains the following powers of 2:
+
+$2^2=4$, $2^3=8$, $2^5=32$, $2^7=128$, $2^{11}=2048$, $2^{13}=8192$, $2^{17}=131072$, $2^{19}=524288$, $\\ldots$
+
+which are the prime powers of 2.
+
+# --instructions--
+
+Write a function that takes a fractran program as a string parameter and returns the first 10 numbers of the program as an array. If the result does not have 10 numbers then return the numbers as is.
# --hints--
-`fractran`应该是一个功能。
+`fractran` should be a function.
```js
assert(typeof fractran == 'function');
```
-`fractran(""+tests[0]+"")`应该返回一个数组。
+`fractran("3/2, 1/3")` should return an array.
```js
assert(Array.isArray(fractran('3/2, 1/3')));
```
-`fractran(""+tests[0]+"")`应返回`"+JSON.stringify(results[0])+"` 。
+`fractran("3/2, 1/3")` should return `[ 2, 3, 1 ]`.
```js
assert.deepEqual(fractran('3/2, 1/3'), [2, 3, 1]);
```
-`fractran(""+tests[1]+"")`应返回`"+JSON.stringify(results[1])+"` 。
+`fractran("3/2, 5/3, 1/5")` should return `[ 2, 3, 5, 1 ]`.
```js
assert.deepEqual(fractran('3/2, 5/3, 1/5'), [2, 3, 5, 1]);
```
-`fractran(""+tests[2]+"")`应返回`"+JSON.stringify(results[2])+"` 。
+`fractran("3/2, 6/3")` should return `[ 2, 3, 6, 9, 18, 27, 54, 81, 162, 243 ]`.
```js
assert.deepEqual(fractran('3/2, 6/3'), [2, 3, 6, 9, 18, 27, 54, 81, 162, 243]);
```
-`fractran(""+tests[3]+"")`应返回`"+JSON.stringify(results[3])+"` 。
+`fractran("2/7, 7/2")` should return `[ 2, 7, 2, 7, 2, 7, 2, 7, 2, 7 ]`.
```js
assert.deepEqual(fractran('2/7, 7/2'), [2, 7, 2, 7, 2, 7, 2, 7, 2, 7]);
```
-`fractran(""+tests[4]+"")`应返回`"+JSON.stringify(results[4])+"` 。
+`fractran("17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1")` should return `[ 2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290 ]`.
```js
assert.deepEqual(
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/gamma-function.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/gamma-function.md
index 152f2916264..f105a0a1bd5 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/gamma-function.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/gamma-function.md
@@ -1,56 +1,58 @@
---
id: 5a23c84252665b21eecc7e76
-title: 伽玛功能
+title: Gamma function
challengeType: 5
-videoUrl: ''
+forumTopicId: 302271
dashedName: gamma-function
---
# --description--
-实现一个算法(或更多)来计算[Gamma]() ($ \\ Gamma $)函数(仅在实际字段中)。 Gamma功能可以定义为:
+Implement one algorithm (or more) to compute the [Gamma](https://en.wikipedia.org/wiki/Gamma function) ($\\Gamma$) function (in the real field only).
-$ \\ Gamma(x)= \\ displaystyle \\ int_0 ^ \\ infty t ^ {x-1} e ^ { - t} dt $
+The Gamma function can be defined as:
+
+$\Gamma(x) = \displaystyle\int_0^\infty t^{x-1}e^{-t} dt$
# --hints--
-`gamma`应该是一个功能。
+`gamma` should be a function.
```js
assert(typeof gamma == 'function');
```
-`gamma("+tests[0]+")`应该返回一个数字。
+`gamma(.1)` should return a number.
```js
assert(typeof gamma(0.1) == 'number');
```
-`gamma("+tests[0]+")`应该返回`"+results[0]+"` 。
+`gamma(.1)` should return `9.513507698668736`.
```js
assert.equal(round(gamma(0.1)), round(9.513507698668736));
```
-`gamma("+tests[1]+")`应该返回`"+results[1]+"` 。
+`gamma(.2)` should return `4.590843711998803`.
```js
assert.equal(round(gamma(0.2)), round(4.590843711998803));
```
-`gamma("+tests[2]+")`应该返回`"+results[2]+"` 。
+`gamma(.3)` should return `2.9915689876875904`.
```js
assert.equal(round(gamma(0.3)), round(2.9915689876875904));
```
-`gamma("+tests[3]+")`应该返回`"+results[3]+"` 。
+`gamma(.4)` should return `2.218159543757687`.
```js
assert.equal(round(gamma(0.4)), round(2.218159543757687));
```
-`gamma("+tests[4]+")`应返回`"+results[4]+"` 。
+`gamma(.5)` should return `1.7724538509055159`.
```js
assert.equal(round(gamma(0.5)), round(1.7724538509055159));
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/gaussian-elimination.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/gaussian-elimination.md
index bfef3fa4012..2e5adf4bd9e 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/gaussian-elimination.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/gaussian-elimination.md
@@ -1,24 +1,28 @@
---
id: 5a23c84252665b21eecc7e77
-title: 高斯消除
+title: Gaussian elimination
challengeType: 5
-videoUrl: ''
+forumTopicId: 302272
dashedName: gaussian-elimination
---
# --description--
-编写一个函数来解决\\(Ax = b \\)使用高斯消除然后向后替换。 \\(A \\)是\\(n \\次n \\)矩阵。此外,\\(x \\)和\\(b \\)是\\(n \\)乘以1个向量。要提高准确性,请使用部分旋转和缩放。
+Write a function to solve \\(Ax = b\\) using Gaussian elimination then backwards substitution.
+
+\\(A\\) being an \\(n \\times n\\) matrix. Also, \\(x\\) and \\(b\\) are \\(n\\) by 1 vectors.
+
+To improve accuracy, please use partial pivoting and scaling.
# --hints--
-`gaussianElimination`应该是一个函数。
+`gaussianElimination` should be a function.
```js
assert(typeof gaussianElimination == 'function');
```
-`gaussianElimination("+JSON.stringify(tests[0][0])+","+JSON.stringify(tests[0][1])+")`应该返回一个数组。
+`gaussianElimination([[1,1],[1,-1]], [5,1])` should return an array.
```js
assert(
@@ -34,7 +38,7 @@ assert(
);
```
-`gaussianElimination("+JSON.stringify(tests[0][0])+","+JSON.stringify(tests[0][1])+")`应返回`"+JSON.stringify(results[0])+"` 。
+`gaussianElimination([[1,1],[1,-1]], [5,1])` should return `[ 3, 2 ]`.
```js
assert.deepEqual(
@@ -49,7 +53,7 @@ assert.deepEqual(
);
```
-`gaussianElimination("+JSON.stringify(tests[1][0])+","+JSON.stringify(tests[1][1])+")`应返回`"+JSON.stringify(results[1])+"` 。
+`gaussianElimination([[2,3],[2,1]] , [8,4])` should return `[ 1, 2 ]`.
```js
assert.deepEqual(
@@ -64,7 +68,7 @@ assert.deepEqual(
);
```
-`gaussianElimination("+JSON.stringify(tests[2][0])+","+JSON.stringify(tests[2][1])+")`应返回`"+JSON.stringify(results[2])+"` 。
+`gaussianElimination([[1,3],[5,-2]], [14,19])` should return `[ 5, 3 ]`.
```js
assert.deepEqual(
@@ -79,7 +83,7 @@ assert.deepEqual(
);
```
-`gaussianElimination("+JSON.stringify(tests[3][0])+","+JSON.stringify(tests[3][1])+")`应返回`"+JSON.stringify(results[3])+"` 。
+`gaussianElimination([[1,1],[5,-1]] , [10,14])` should return `[ 4, 6 ]`.
```js
assert.deepEqual(
@@ -94,7 +98,7 @@ assert.deepEqual(
);
```
-`gaussianElimination("+JSON.stringify(tests[4][0])+","+JSON.stringify(tests[4][1])+")`应返回`"+JSON.stringify(results[4])+"` 。
+`gaussianElimination([[1,2,3],[4,5,6],[7,8,8]] , [6,15,23])` should return `[ 1, 1, 1 ]`.
```js
assert.deepEqual(
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/general-fizzbuzz.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/general-fizzbuzz.md
index c1a0c3b59ec..4af8e94f0e3 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/general-fizzbuzz.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/general-fizzbuzz.md
@@ -1,24 +1,32 @@
---
id: 5a23c84252665b21eecc7e78
-title: 一般的FizzBuzz
+title: General FizzBuzz
challengeType: 5
-videoUrl: ''
+forumTopicId: 302273
dashedName: general-fizzbuzz
---
# --description--
-编写[FizzBuzz](http://rosettacode.org/wiki/FizzBuzz)的通用版本,适用于任何因子列表及其单词。这基本上是一种“fizzbuzz”实现,其中游戏规则被提供给用户。创建一个实现此功能的函数。该函数应该有两个参数。第一个是带有FizzBuzz规则的数组。例如: `[ [3,"Fizz"] , [5,"Buzz"] ]` 。此indcates该`Fizz` ,如果数量是3的倍数,并应被打印`Buzz`如果是5的倍数。如果它是两则字符串应该在阵列中指定的顺序被连结的倍数。在这种情况下,如果数字是3和5的倍数,则为`FizzBuzz` 。第二个参数是函数应返回如上所述的字符串的数字。
+Write a generalized version of [FizzBuzz](https://rosettacode.org/wiki/FizzBuzz) that works for any list of factors, along with their words.
+
+This is basically a "fizzbuzz" implementation where the rules of the game are supplied to the user. Create a function to implement this. The function should take two parameters.
+
+The first will be an array with the FizzBuzz rules. For example: `[ [3, "Fizz"] , [5, "Buzz"] ]`.
+
+This indicates that `Fizz` should be printed if the number is a multiple of 3 and `Buzz` if it is a multiple of 5. If it is a multiple of both then the strings should be concatenated in the order specified in the array. In this case, `FizzBuzz` if the number is a multiple of 3 and 5.
+
+The second parameter is the number for which the function should return a string as stated above.
# --hints--
-`genFizzBuzz`应该是一个功能。
+`genFizzBuzz` should be a function.
```js
assert(typeof genFizzBuzz == 'function');
```
-`genFizzBuzz("+JSON.stringify(tests[0][0])+","+tests[0][1]+")`应该返回一个类型。
+`genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6)` should return a string.
```js
assert(
@@ -32,7 +40,7 @@ assert(
);
```
-`genFizzBuzz("+JSON.stringify(tests[0][0])+","+tests[0][1]+")`应返回`""+results[0]+""` 。
+`genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6)` should return `"Fizz"`.
```js
assert.equal(
@@ -47,7 +55,7 @@ assert.equal(
);
```
-`genFizzBuzz("+JSON.stringify(tests[1][0])+","+tests[1][1]+")`应返回`""+results[1]+""` 。
+`genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 10)` should return `"Buzz"`.
```js
assert.equal(
@@ -62,7 +70,7 @@ assert.equal(
);
```
-`genFizzBuzz("+JSON.stringify(tests[2][0])+","+tests[2][1]+")`应返回`""+results[2]+""` 。
+`genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 12)` should return `"Buzz"`.
```js
assert.equal(
@@ -77,7 +85,7 @@ assert.equal(
);
```
-`genFizzBuzz("+JSON.stringify(tests[3][0])+","+tests[3][1]+")`应返回`""+results[3]+""` 。
+`genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 13)` should return `"13"`.
```js
assert.equal(
@@ -92,7 +100,7 @@ assert.equal(
);
```
-`genFizzBuzz("+JSON.stringify(tests[4][0])+","+tests[4][1]+")`应该返回`""+results[4]+""` 。
+`genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 15)` should return `"BuzzFizz"`.
```js
assert.equal(
@@ -107,7 +115,7 @@ assert.equal(
);
```
-`genFizzBuzz("+JSON.stringify(tests[5][0])+","+tests[5][1]+")`应返回`""+results[5]+""` 。
+`genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 15)` should return `"FizzBuzz"`.
```js
assert.equal(
@@ -122,7 +130,7 @@ assert.equal(
);
```
-`genFizzBuzz("+JSON.stringify(tests[6][0])+","+tests[6][1]+")`应该返回`""+results[6]+""` 。
+`genFizzBuzz([[3, "Fizz"],[5, "Buzz"],[7, "Baxx"]], 105)` should return `"FizzBuzzBaxx"`.
```js
assert.equal(
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/generate-lower-case-ascii-alphabet.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/generate-lower-case-ascii-alphabet.md
index d6aad561f10..5f643c3a38b 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/generate-lower-case-ascii-alphabet.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/generate-lower-case-ascii-alphabet.md
@@ -1,54 +1,54 @@
---
id: 5a23c84252665b21eecc7e7a
-title: 生成小写ASCII字母表
+title: Generate lower case ASCII alphabet
challengeType: 5
-videoUrl: ''
+forumTopicId: 302274
dashedName: generate-lower-case-ascii-alphabet
---
# --description--
-编写一个函数以生成给定范围的小写ASCII字符数组。例如:对于范围1到4,函数应返回`['a','b','c','d']` 。
+Write a function to generate an array of lower case ASCII characters for a given range. For example, given the range `['a', 'd']`, the function should return `['a', 'b', 'c', 'd']`.
# --hints--
-`lascii`应该是一个功能。
+`lascii` should be a function.
```js
assert(typeof lascii == 'function');
```
-`lascii("a","d")`应该返回一个数组。
+`lascii("a","d")` should return an array.
```js
assert(Array.isArray(lascii('a', 'd')));
```
-`lascii("a","d")`应该返回`[ "a", "b", "c", "d" ]` 。
+`lascii('a','d')` should return `[ 'a', 'b', 'c', 'd' ]`.
```js
assert.deepEqual(lascii('a', 'd'), results[0]);
```
-`lascii("c","i")`应该返回`[ "c", "d", "e", "f", "g", "h", "i" ]` 。
+`lascii('c','i')` should return `[ 'c', 'd', 'e', 'f', 'g', 'h', 'i' ]`.
```js
assert.deepEqual(lascii('c', 'i'), results[1]);
```
-`lascii("m","q")`应该返回`[ "m", "n", "o", "p", "q" ]` 。
+`lascii('m','q')` should return `[ 'm', 'n', 'o', 'p', 'q' ]`.
```js
assert.deepEqual(lascii('m', 'q'), results[2]);
```
-`lascii("k","n")`应返回`[ "k", "l", "m", "n" ]` 。
+`lascii('k','n')` should return `[ 'k', 'l', 'm', 'n' ]`.
```js
assert.deepEqual(lascii('k', 'n'), results[3]);
```
-`lascii("t","z")`应该返回`[ "t", "u", "v", "w", "x", "y", "z" ]` 。
+`lascii('t','z')` should return `[ 't', 'u', 'v', 'w', 'x', 'y', 'z' ]`.
```js
assert.deepEqual(lascii('t', 'z'), results[4]);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/gray-code.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/gray-code.md
index 2515bf0d142..f46350f0be6 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/gray-code.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/gray-code.md
@@ -1,64 +1,94 @@
---
id: 5a23c84252665b21eecc7e80
-title: 格雷码
+title: Gray code
challengeType: 5
-videoUrl: ''
+forumTopicId: 302276
dashedName: gray-code
---
# --description--
-[格雷码]()是二进制编码的一种形式,其中连续数字之间的转换仅相差一位。这是一种有用的编码,用于减少硬件数据危险,其值快速变化和/或连接到较慢的硬件作为输入。从左到右或从上到下依次为[卡诺图]()生成输入也很有用。创建一个函数来编码数字并解码格雷码中的数字。该函数应该有2个参数。第一个是布尔值。该函数应编码为true,解码为false。第二个参数是要编码/解码的数字。显示所有5位二进制数的正常二进制表示,格雷码表示和解码格雷码值(0-31包括0,不需要前导0)。有许多可能的格雷码。以下编码所谓的“二进制反射格雷码”。
-编码(MSB为0位,b为二进制,g为格雷码):
if b[i-1] = 1
g[i] = not b[i]
else
g[i] = b[i]
要么:
-`g = b xor (b logically right shifted 1 time)`
-解码(MSB为0位,b为二进制,g为格雷码):
-b[0] = g[0]
for other bits:
b[i] = g[i] xor b[i-1]
+[Gray code](https://en.wikipedia.org/wiki/Gray code) is a form of binary encoding where transitions between consecutive numbers differ by only one bit.
+
+This is a useful encoding for reducing hardware data hazards with values that change rapidly and/or connect to slower hardware as inputs.
+
+It is also useful for generating inputs for [Karnaugh maps](https://en.wikipedia.org/wiki/Karnaugh map) in order from left to right or top to bottom.
+
+# --instructions--
+
+Create a function to encode a number to and decode a number from Gray code. The function should will have 2 parameters.
+
+The first would be a boolean. The function should encode for true and decode for false. The second parameter would be the number to be encoded/decoded.
+
+Display the normal binary representations, Gray code representations, and decoded Gray code values for all 5-bit binary numbers (0-31 inclusive, leading 0's not necessary).
+
+There are many possible Gray codes. The following encodes what is called "binary reflected Gray code."
+
+Encoding (MSB is bit 0, b is binary, g is Gray code):
+
+if b[i-1] = 1
+ g[i] = not b[i]
+else
+ g[i] = b[i]
+
+
+Or:
+
+g = b xor (b logically right shifted 1 time)
+
+
+Decoding (MSB is bit 0, b is binary, g is Gray code):
+
+b[0] = g[0]
+for other bits:
+b[i] = g[i] xor b[i-1]
+
# --hints--
-`gray`应该是一个功能。
+`gray` should be a function.
```js
assert(typeof gray == 'function');
```
-`gray(true,177)`应该返回一个数字。
+`gray(true,177)` should return a number.
```js
assert(typeof gray(true, 177) == 'number');
```
-`gray(true,177)`应该返回`233` 。
+`gray(true,177)` should return `233`.
```js
assert.equal(gray(true, 177), 233);
```
-`gray(true,425)`应该返回`381` 。
+`gray(true,425)` should return `381`.
```js
assert.equal(gray(true, 425), 381);
```
-`gray(true,870)`应该返回`725` 。
+`gray(true,870)` should return `725`.
```js
assert.equal(gray(true, 870), 725);
```
-`gray(false,233)`应该返回`177` 。
+`gray(false,233)` should return `177`.
```js
assert.equal(gray(false, 233), 177);
```
-`gray(false,381)`应该返回`425` 。
+`gray(false,381)` should return `425`.
```js
assert.equal(gray(false, 381), 425);
```
-`gray(false,725)`应该返回`870` 。
+`gray(false,725)` should return `870`.
```js
assert.equal(gray(false, 725), 870);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/greatest-common-divisor.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/greatest-common-divisor.md
index e70a483fe3b..60b96750188 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/greatest-common-divisor.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/greatest-common-divisor.md
@@ -1,60 +1,60 @@
---
id: 5a23c84252665b21eecc7e82
-title: 最大公约数
+title: Greatest common divisor
challengeType: 5
-videoUrl: ''
+forumTopicId: 302277
dashedName: greatest-common-divisor
---
# --description--
-编写一个函数,返回两个整数的最大公约数。
+Write a function that returns the greatest common divisor of two integers.
# --hints--
-`gcd`应该是一个功能。
+`gcd` should be a function.
```js
assert(typeof gcd == 'function');
```
-`gcd(24,36)`应该返回一个数字。
+`gcd(24,36)` should return a number.
```js
assert(typeof gcd(24, 36) == 'number');
```
-`gcd(24,36)`应该返回`12` 。
+`gcd(24,36)` should return `12`.
```js
assert.equal(gcd(24, 36), 12);
```
-`gcd(30,48)`应该返回`6` 。
+`gcd(30,48)` should return `6`.
```js
assert.equal(gcd(30, 48), 6);
```
-`gcd(10,15)`应该返回`5` 。
+`gcd(10,15)` should return `5`.
```js
assert.equal(gcd(10, 15), 5);
```
-`gcd(100,25)`应该返回`25` 。
+`gcd(100,25)` should return `25`.
```js
assert.equal(gcd(100, 25), 25);
```
-`gcd(13,250)`应该返回`1` 。
+`gcd(13,250)` should return `1`.
```js
assert.equal(gcd(13, 250), 1);
```
-`gcd(1300,250)`应该返回`50` 。
+`gcd(1300,250)` should return `50`.
```js
assert.equal(gcd(1300, 250), 50);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/greatest-subsequential-sum.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/greatest-subsequential-sum.md
index 03deb01b433..4a90c111fe2 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/greatest-subsequential-sum.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/greatest-subsequential-sum.md
@@ -1,36 +1,38 @@
---
id: 5a23c84252665b21eecc7e84
-title: 最重要的后续总和
+title: Greatest subsequential sum
challengeType: 5
-videoUrl: ''
+forumTopicId: 302278
dashedName: greatest-subsequential-sum
---
# --description--
-给定一个整数序列,找到一个连续的子序列,它最大化其元素的总和,也就是说,没有其他单个子序列的元素加起来大于这一个的值。空子序列被认为具有\\(0 \\)的总和;因此,如果所有元素都是负数,则结果必须是空序列。
+Given a sequence of integers, find a continuous subsequence which maximizes the sum of its elements, that is, the elements of no other single subsequence add up to a value larger than this one.
+
+An empty subsequence is considered to have the sum of \\( 0 \\); thus if all elements are negative, the result must be the empty sequence.
# --hints--
-`maximumSubsequence`应该是一个函数。
+`maximumSubsequence` should be a function.
```js
assert(typeof maximumSubsequence == 'function');
```
-`maximumSubsequence("+JSON.stringify(tests[0])+")`应该返回一个数组。
+`maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])` should return an array.
```js
assert(Array.isArray(maximumSubsequence([1, 2, -1, 3, 10, -10])));
```
-`maximumSubsequence("+JSON.stringify(tests[0])+")`应返回`"+JSON.stringify(results[0])+"` 。
+`maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])` should return `[ 1, 2, -1, 3, 10 ]`.
```js
assert.deepEqual(maximumSubsequence([1, 2, -1, 3, 10, -10]), [1, 2, -1, 3, 10]);
```
-`maximumSubsequence("+JSON.stringify(tests[1])+")`应返回`"+JSON.stringify(results[1])+"` 。
+`maximumSubsequence([ 0, 8, 10, -2, -4, -1, -5, -3 ])` should return `[ 0, 8, 10 ]`.
```js
assert.deepEqual(maximumSubsequence([0, 8, 10, -2, -4, -1, -5, -3]), [
@@ -40,25 +42,25 @@ assert.deepEqual(maximumSubsequence([0, 8, 10, -2, -4, -1, -5, -3]), [
]);
```
-`maximumSubsequence("+JSON.stringify(tests[2])+")`应返回`"+JSON.stringify(results[2])+"` 。
+`maximumSubsequence([ 9, 9, -10, 1 ])` should return `[ 9, 9 ]`.
```js
assert.deepEqual(maximumSubsequence([9, 9, -10, 1]), [9, 9]);
```
-`maximumSubsequence("+JSON.stringify(tests[3])+")`应返回`"+JSON.stringify(results[3])+"` 。
+`maximumSubsequence([ 7, 1, -5, -3, -8, 1 ])` should return `[ 7, 1 ]`.
```js
assert.deepEqual(maximumSubsequence([7, 1, -5, -3, -8, 1]), [7, 1]);
```
-`maximumSubsequence("+JSON.stringify(tests[4])+")`应返回`"+JSON.stringify(results[4])+"` 。
+`maximumSubsequence([ -3, 6, -1, 4, -4, -6 ])` should return `[ 6, -1, 4 ]`.
```js
assert.deepEqual(maximumSubsequence([-3, 6, -1, 4, -4, -6]), [6, -1, 4]);
```
-`maximumSubsequence("+JSON.stringify(tests[5])+")`应返回`"+JSON.stringify(results[5])+"` 。
+`maximumSubsequence([ -1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1 ])` should return `[ 3, 5, 6, -2, -1, 4 ]`.
```js
assert.deepEqual(maximumSubsequence([-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1]), [
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hailstone-sequence.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hailstone-sequence.md
index 9d0e4ca1e3f..e7587e2f999 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hailstone-sequence.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hailstone-sequence.md
@@ -1,24 +1,48 @@
---
id: 595608ff8bcd7a50bd490181
-title: 冰雹序列
+title: Hailstone sequence
challengeType: 5
-videoUrl: ''
+forumTopicId: 302279
dashedName: hailstone-sequence
---
# --description--
- Hailstone数字序列可以从起始正整数n生成:
如果n为1,则序列结束。如果n是偶数,那么序列的下一个n = n/2如果n是奇数,那么序列的下一个n = (3 \* n) + 1 (未经证实的) Collatz猜想是任何起始编号的冰雹序列总是终止。
冰雹序列也称为冰雹数(因为这些值通常受到多个下降和上升,如云中的冰雹),或者作为Collatz序列。
任务:创建例程以生成数字的hailstone序列。使用例程表明,对于27号的冰雹序列具有开始与112个元件27, 82, 41, 124 ,结束时用8, 4, 2, 1与显示具有最长冰雹序列的数目少于100,000一起序列的长度。 (但不要显示实际的序列!)参见: xkcd (幽默)。
+The Hailstone sequence of numbers can be generated from a starting positive integer, `n` by:
+
+
+ - If
n is 1 then the sequence ends
+ - If
n is even then the next n of the sequence = n/2
+ - If
n is odd then the next n of the sequence = (3 * n) + 1
+
+
+The (unproven) [Collatz conjecture](https://en.wikipedia.org/wiki/Collatz conjecture "wp: Collatz conjecture") is that the hailstone sequence for any starting number always terminates.
+
+The hailstone sequence is also known as hailstone numbers (because the values are usually subject to multiple descents and ascents like hailstones in a cloud), or as the Collatz sequence.
+
+# --instructions--
+
+
+ - Create a routine to generate the hailstone sequence for a number
+ - Use the routine to show that the hailstone sequence for the number 27 has 112 elements starting with
27, 82, 41, 124 and ending with 8, 4, 2, 1
+ - Show the number less than 100,000 which has the longest hailstone sequence together with that sequence's length. (But don't show the actual sequence!)
+
+
+**See also:**
+
+
# --hints--
-`hailstoneSequence`是一个函数。
+`hailstoneSequence` should be a function.
```js
assert(typeof hailstoneSequence === 'function');
```
-`[[27,82,41,124,8,4,2,1], [351, 77031]]` `hailstoneSequence()`应返回`[[27,82,41,124,8,4,2,1], [351, 77031]]`
+`hailstoneSequence()` should return `[[27,82,41,124,8,4,2,1], [351, 77031]]`
```js
assert.deepEqual(hailstoneSequence(), res);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/happy-numbers.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/happy-numbers.md
index 5aba3634788..6eb49885391 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/happy-numbers.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/happy-numbers.md
@@ -1,90 +1,96 @@
---
id: 594810f028c0303b75339ad1
-title: 快乐的数字
+title: Happy numbers
challengeType: 5
-videoUrl: ''
+forumTopicId: 302280
dashedName: happy-numbers
---
# --description--
-幸福的数字由以下过程定义:
从任何正整数开始,将数字替换为其数字的平方和,并重复该过程直到数字等于1(它将保持不变),或者它在一个不包括1的循环中无休止地循环。这些数字这个过程在1结束的是幸福的数字,而那些不以1结尾的数字是不愉快的数字。
实现一个函数,如果数字是满意的,则返回true,否则返回false。
+A [happy number](https://en.wikipedia.org/wiki/Happy_number) is defined by the following process:
+
+Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals `1` (where it will stay), or it loops endlessly in a cycle which does not include `1`. Those numbers for which this process ends in `1` are happy numbers, while those that do not end in `1` are unhappy numbers.
+
+# --instructions--
+
+Implement a function that returns true if the number is happy, or false if not.
# --hints--
-`happy`是一种功能。
+`happy` should be a function.
```js
assert(typeof happy === 'function');
```
-`happy(1)`应该返回一个布尔值。
+`happy(1)` should return a boolean.
```js
assert(typeof happy(1) === 'boolean');
```
-`happy(1)`应该回归真实。
+`happy(1)` should return true.
```js
assert(happy(1));
```
-`happy(2)`应该返回虚假。
+`happy(2)` should return false.
```js
assert(!happy(2));
```
-`happy(7)`应该回归真实。
+`happy(7)` should return true.
```js
assert(happy(7));
```
-`happy(10)`应该回归真实。
+`happy(10)` should return true.
```js
assert(happy(10));
```
-`happy(13)`应该回归真实。
+`happy(13)` should return true.
```js
assert(happy(13));
```
-`happy(19)`应该回归真实。
+`happy(19)` should return true.
```js
assert(happy(19));
```
-`happy(23)`应该回归真实。
+`happy(23)` should return true.
```js
assert(happy(23));
```
-`happy(28)`应该回归真实。
+`happy(28)` should return true.
```js
assert(happy(28));
```
-`happy(31)`应该回归真实。
+`happy(31)` should return true.
```js
assert(happy(31));
```
-`happy(32)`应该回归真实:
+`happy(32)` should return true:.
```js
assert(happy(32));
```
-`happy(33)`应该返回虚假。
+`happy(33)` should return false.
```js
assert(!happy(33));
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/harshad-or-niven-series.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/harshad-or-niven-series.md
index fecd4a27bfb..383989816ae 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/harshad-or-niven-series.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/harshad-or-niven-series.md
@@ -1,24 +1,34 @@
---
id: 595668ca4cfe1af2fb9818d4
-title: Harshad或Niven系列
+title: Harshad or Niven series
challengeType: 5
-videoUrl: ''
+forumTopicId: 302281
dashedName: harshad-or-niven-series
---
# --description--
- Harshad或Niven数是正整数≥1,可以被它们的数字之和整除。
例如,42是Harshad数,因为42可以被(4 + 2)整除而没有余数。
假设系列被定义为按递增顺序排列的数字。任务: 实现一个函数来生成Harshad序列的连续成员。
使用它列出序列的前20个成员并列出第一个大于1000的Harshad数。
+The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits.
+
+For example, `42` is a [Harshad number](https://rosettacode.org/wiki/Harshad_or_Niven_series "Harshad or Niven series") as `42` is divisible by `(4 + 2)` without remainder.
+
+Assume that the series is defined as the numbers in increasing order.
+
+# --instructions--
+
+Implement a function to generate successive members of the Harshad sequence.
+
+Use it to list the first twenty members of the sequence and list the first Harshad number greater than 1000.
# --hints--
-`isHarshadOrNiven`是一个函数。
+`isHarshadOrNiven` should be a function.
```js
assert(typeof isHarshadOrNiven === 'function');
```
-`isHarshadOrNiven()`应该返回`{"firstTwenty": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42],"firstOver1000": 1002}`
+`isHarshadOrNiven()` should return `{"firstTwenty": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42],"firstOver1000": 1002}`
```js
assert.deepEqual(isHarshadOrNiven(), res);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hash-from-two-arrays.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hash-from-two-arrays.md
index ee9e64ec850..d5a9a396bb9 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hash-from-two-arrays.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hash-from-two-arrays.md
@@ -1,58 +1,60 @@
---
id: 595671d4d2cdc305f0d5b36f
-title: 来自两个数组的哈希
+title: Hash from two arrays
challengeType: 5
-videoUrl: ''
+forumTopicId: 302283
dashedName: hash-from-two-arrays
---
# --description--
-任务:
+Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values).
-使用两个相等长度的数组,创建一个Hash对象,其中一个数组中的元素(键)链接到另一个数组(值)
+**Related task:**
-相关任务: [关联数组/创建]( "关联数组/创建")
+
# --hints--
-`arrToObj`是一个功能。
+`arrToObj` should be a function.
```js
assert(typeof arrToObj === 'function');
```
-`arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d", "e"])`应返回`{ 1: "a", 2: "b", 3: "c", 4: "d", 5: "e" }`
+`arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d", "e"])` should return `{ 1: "a", 2: "b", 3: "c", 4: "d", 5: "e" }`
```js
assert.deepEqual(arrToObj(...testCases[0]), res[0]);
```
-`arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d"])`应返回`{ 1: "a", 2: "b", 3: "c", 4: "d", 5: undefined }`
+`arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d"])` should return `{ 1: "a", 2: "b", 3: "c", 4: "d", 5: undefined }`
```js
assert.deepEqual(arrToObj(...testCases[1]), res[1]);
```
-`arrToObj([1, 2, 3], ["a", "b", "c", "d", "e"])`应返回`{ 1: "a", 2: "b", 3: "c" }`
+`arrToObj([1, 2, 3], ["a", "b", "c", "d", "e"])` should return `{ 1: "a", 2: "b", 3: "c" }`
```js
assert.deepEqual(arrToObj(...testCases[2]), res[2]);
```
-`arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4, 5])`应返回`{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": 5 }`
+`arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4, 5])` should return `{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": 5 }`
```js
assert.deepEqual(arrToObj(...testCases[3]), res[3]);
```
-`arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4])`应返回`{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": undefined }`
+`arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4])` should return `{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": undefined }`
```js
assert.deepEqual(arrToObj(...testCases[4]), res[4]);
```
-`arrToObj(["a", "b", "c"], [1, 2, 3, 4, 5])`应返回`{ "a": 1, "b": 2, "c": 3 }`
+`arrToObj(["a", "b", "c"], [1, 2, 3, 4, 5])` should return `{ "a": 1, "b": 2, "c": 3 }`
```js
assert.deepEqual(arrToObj(...testCases[5]), res[5]);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hash-join.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hash-join.md
index efdad81ee39..7dc6b729cb6 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hash-join.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hash-join.md
@@ -1,36 +1,155 @@
---
id: 5956795bc9e2c415eb244de1
-title: 哈希加入
+title: Hash join
challengeType: 5
-videoUrl: ''
+forumTopicId: 302284
dashedName: hash-join
---
# --description--
- 内连接是一种操作,它根据匹配的列值将两个数据表组合到一个表中。实现此操作的最简单方法是嵌套循环连接算法,但更可扩展的替代方法是散列连接算法。
实现“散列连接”算法,并演示它通过下面列出的测试用例。
您应该将表表示为在编程语言中感觉自然的数据结构。
“散列连接”算法包含两个步骤:
哈希阶段:从两个表中的一个表创建一个多图,从每个连接列值映射到包含它的所有行。多图必须支持基于散列的查找,它比简单的线性搜索更好地扩展,因为这是该算法的重点。理想情况下,我们应该为较小的表创建多图,从而最小化其创建时间和内存大小。加入阶段:扫描另一个表,通过查看之前创建的多图来查找匹配的行。 在伪代码中,算法可以表示如下:
让A =第一个输入表(或理想情况下,更大的输入表)
-设B =第二个输入表(或理想情况下,较小的输入表)
-令j A =表A的连接列ID
-令j B =表B的连接列ID
-让M B =一个多图,用于从单个值映射到表B的多行(从空白开始)
-让C =输出表(从空开始)
-对于表B中的每一行b:
- 将b放在密钥b(j B )下的多映射M B中
-对于表A中的每一行a:
- 对于a(j A )项下多图M B中的每一行b:
- 设c =第a行和第b行的串联
- 将行c放在表C中
-
测试用例输入
| A = | | 年龄 | 名称 |
|---|
| 27 | 约拿 | | 18 | 艾伦 | | 28 | 荣耀 | | 18 | 大力水手 | | 28 | 艾伦 |
| | B = | | 字符 | 复仇者 |
|---|
| 约拿 | 鲸鱼 | | 约拿 | 蜘蛛 | | 艾伦 | 鬼 | | 艾伦 | 植物大战僵尸 | | 荣耀 | 巴菲 |
| | j A = | Name (即第1栏) | j B = | Character (即第0列) |
| |
产量
| A.Age | 一个名字 | B.Character | B.Nemesis |
|---|
| 27 | 约拿 | 约拿 | 鲸鱼 |
| 27 | 约拿 | 约拿 | 蜘蛛 |
| 18 | 艾伦 | 艾伦 | 鬼 |
| 18 | 艾伦 | 艾伦 | 植物大战僵尸 |
| 28 | 荣耀 | 荣耀 | 巴菲 |
| 28 | 艾伦 | 艾伦 | 鬼 |
| 28 | 艾伦 | 艾伦 | 植物大战僵尸 |
输出表中行的顺序并不重要。
如果你使用数字索引数组来表示表行(而不是按名称引用列),你可以用[[27, "Jonah"], ["Jonah", "Whales"]]的形式表示输出行。 。
+An [inner join](https://en.wikipedia.org/wiki/Join_(SQL)#Inner_join "wp: Join\_(SQL)#Inner_join") is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the [nested loop join](https://en.wikipedia.org/wiki/Nested loop join "wp: Nested loop join") algorithm, but a more scalable alternative is the [hash join](https://en.wikipedia.org/wiki/hash join "wp: hash join") algorithm.
+
+The "hash join" algorithm consists of two steps:
+
+
+ - Hash phase: Create a multimap from one of the two tables, mapping from each join column value to all the rows that contain it.
+
+ - The multimap must support hash-based lookup which scales better than a simple linear search, because that's the whole point of this algorithm.
+ - Ideally we should create the multimap for the smaller table, thus minimizing its creation time and memory size.
+
+ - Join phase: Scan the other table, and find matching rows by looking in the multimap created before.
+
+
+In pseudo-code, the algorithm could be expressed as follows:
+
+let A = the first input table (or ideally, the larger one)
+let B = the second input table (or ideally, the smaller one)
+let jA = the join column ID of table A
+let jB = the join column ID of table B
+let MB = a multimap for mapping from single values to multiple rows of table B (starts out empty)
+let C = the output table (starts out empty)
+for each row b in table B:
+ place b in multimap MB under key b(jB)
+for each row a in table A:
+ for each row b in multimap MB under key a(jA):
+ let c = the concatenation of row a and row b
+ place row c in table C
+
+
+# --instructions--
+
+Implement the "hash join" algorithm as a function and demonstrate that it passes the test-case listed below. The function should accept two arrays of objects and return an array of combined objects.
+
+**Input**
+
+
+
+
+
+
+ | A = |
+
+
+
+ | Age |
+ Name |
+
+
+ | 27 |
+ Jonah |
+
+
+ | 18 |
+ Alan |
+
+
+ | 28 |
+ Glory |
+
+
+ | 18 |
+ Popeye |
+
+
+ | 28 |
+ Alan |
+
+
+ |
+ |
+ B = |
+
+
+
+ | Character |
+ Nemesis |
+
+
+ | Jonah |
+ Whales |
+
+
+ | Jonah |
+ Spiders |
+
+
+ | Alan |
+ Ghosts |
+
+
+ | Alan |
+ Zombies |
+
+
+ | Glory |
+ Buffy |
+
+
+ |
+
+
+ |
+ jA =
+ |
+
+ Name (i.e. column 1)
+ |
+
+ jB =
+ |
+
+ Character (i.e. column 0)
+ |
+
+
+ |
+
+
+
+**Output**
+
+| A_age | A_name | B_character | B_nemesis |
+| ----- | ------ | ----------- | --------- |
+| 27 | Jonah | Jonah | Whales |
+| 27 | Jonah | Jonah | Spiders |
+| 18 | Alan | Alan | Ghosts |
+| 18 | Alan | Alan | Zombies |
+| 28 | Glory | Glory | Buffy |
+| 28 | Alan | Alan | Ghosts |
+| 28 | Alan | Alan | Zombies |
+
+The order of the rows in the output table is not significant.
# --hints--
-`hashJoin`是一个函数。
+`hashJoin` should be a function.
```js
assert(typeof hashJoin === 'function');
```
-`hashJoin([{ age: 27, name: "Jonah" }, { age: 18, name: "Alan" }, { age: 28, name: "Glory" }, { age: 18, name: "Popeye" }, { age: 28, name: "Alan" }], [{ character: "Jonah", nemesis: "Whales" }, { character: "Jonah", nemesis: "Spiders" }, { character: "Alan", nemesis: "Ghosts" }, { character:"Alan", nemesis: "Zombies" }, { character: "Glory", nemesis: "Buffy" }, { character: "Bob", nemesis: "foo" }])`应该返回`[{"A_age": 27,"A_name": "Jonah", "B_character": "Jonah", "B_nemesis": "Whales"}, {"A_age": 27,"A_name": "Jonah", "B_character": "Jonah", "B_nemesis": "Spiders"}, {"A_age": 18,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Ghosts"}, {"A_age": 18,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Zombies"}, {"A_age": 28,"A_name": "Glory", "B_character": "Glory", "B_nemesis": "Buffy"}, {"A_age": 28,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Ghosts"}, {"A_age": 28,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Zombies"}]`
+`hashJoin([{ age: 27, name: "Jonah" }, { age: 18, name: "Alan" }, { age: 28, name: "Glory" }, { age: 18, name: "Popeye" }, { age: 28, name: "Alan" }], [{ character: "Jonah", nemesis: "Whales" }, { character: "Jonah", nemesis: "Spiders" }, { character: "Alan", nemesis: "Ghosts" }, { character:"Alan", nemesis: "Zombies" }, { character: "Glory", nemesis: "Buffy" }, { character: "Bob", nemesis: "foo" }])` should return `[{"A_age": 27,"A_name": "Jonah", "B_character": "Jonah", "B_nemesis": "Whales"}, {"A_age": 27,"A_name": "Jonah", "B_character": "Jonah", "B_nemesis": "Spiders"}, {"A_age": 18,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Ghosts"}, {"A_age": 18,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Zombies"}, {"A_age": 28,"A_name": "Glory", "B_character": "Glory", "B_nemesis": "Buffy"}, {"A_age": 28,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Ghosts"}, {"A_age": 28,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Zombies"}]`
```js
assert.deepEqual(hashJoin(hash1, hash2), res);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/heronian-triangles.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/heronian-triangles.md
index 347befa8dd7..2162dc57eb4 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/heronian-triangles.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/heronian-triangles.md
@@ -1,42 +1,64 @@
---
id: 595b98f8b5a2245e243aa831
-title: 苍鹭三角形
+title: Heronian triangles
challengeType: 5
-videoUrl: ''
+forumTopicId: 302285
dashedName: heronian-triangles
---
# --description--
-给出三边a, b和c长度的三角形区域的英雄公式由下式给出:
$$ A = \ sqrt {s(sa)(sb)(sc)},$$
其中s是三角形的一半周长;那是,
$$ S = \压裂{A + B + C} {2} $$。
Heronian三角形是三角形,其边和面都是整数。
一个例子是边长为3,4,5的三角形,其面积为6(其周长为12)。
注意任何三角形的边都是3,4,5的整数倍;如6,8,10,也将是一个苍鹭三角形。
将原始的Heronian三角形定义为最大公约数的Heronian三角形
三方都是1(统一)。
这将排除例如三角形6,8,10。
任务: 实现一个基于Hero公式的函数,该函数返回数组数组中的前n th有序三角形。
+[Hero's formula](https://en.wikipedia.org/wiki/Heron's formula "wp: Heron's formula") for the area of a triangle given the length of its three sides `a`, `b`, and `c` is given by:
+
+$A = \\sqrt{s(s-a)(s-b)(s-c)},$
+
+where `s` is half the perimeter of the triangle; that is,
+
+$s=\\frac{a+b+c}{2}.$
+
+Heronian triangles are triangles whose sides and area are all integers.
+
+An example is the triangle with sides `3, 4, 5` whose area is `6` (and whose perimeter is `12`).
+
+Note that any triangle whose sides are all an integer multiple of `3, 4, 5`; such as `6, 8, 10,` will also be a Heronian triangle.
+
+Define a Primitive Heronian triangle as a Heronian triangle where the greatest common divisor
+
+of all three sides is `1` (unity).
+
+This will exclude, for example, triangle `6, 8, 10.`
+
+# --instructions--
+
+Implement a function based on Hero's formula that returns the first nth ordered triangles in an array of arrays.
# --hints--
-`heronianTriangle`是一个函数。
+`heronianTriangle` should be a function.
```js
assert(typeof heronianTriangle === 'function');
```
-`heronianTriangle()`应返回`[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17]]` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17]]` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17]]` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17]]` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17]]`
+`heronianTriangle(10)` should return `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17]]`
```js
assert.deepEqual(heronianTriangle(testCases[0]), res[0]);
```
-`heronianTriangle()`应返回`[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15]],` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15]],` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15]],` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15]],` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15]],`
+`heronianTriangle(15)` should return `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15]],`
```js
assert.deepEqual(heronianTriangle(testCases[1]), res[1]);
```
-`heronianTriangle()`应返回`[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53]],` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53]],` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53]],` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53]],` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53]],`
+`heronianTriangle(20)` should return `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53]],`
```js
assert.deepEqual(heronianTriangle(testCases[2]), res[2]);
```
-`heronianTriangle()`应返回`[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53], [19, 20, 37],[16, 17, 17], [17, 17, 30], [16, 25, 39], [13, 20, 21]]` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53], [19, 20, 37],[16, 17, 17], [17, 17, 30], [16, 25, 39], [13, 20, 21]]` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53], [19, 20, 37],[16, 17, 17], [17, 17, 30], [16, 25, 39], [13, 20, 21]]` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53], [19, 20, 37],[16, 17, 17], [17, 17, 30], [16, 25, 39], [13, 20, 21]]` `heronianTriangle()` `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53], [19, 20, 37],[16, 17, 17], [17, 17, 30], [16, 25, 39], [13, 20, 21]]`
+`heronianTriangle(25)` should return `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53], [19, 20, 37],[16, 17, 17], [17, 17, 30], [16, 25, 39], [13, 20, 21]]`
```js
assert.deepEqual(heronianTriangle(testCases[3]), res[3]);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hofstadter-figure-figure-sequences.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hofstadter-figure-figure-sequences.md
index b68fcd4ede1..1b5b864eda0 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hofstadter-figure-figure-sequences.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hofstadter-figure-figure-sequences.md
@@ -1,84 +1,113 @@
---
id: 59622f89e4e137560018a40e
-title: Hofstadter图 - 图序列
+title: Hofstadter Figure-Figure sequences
challengeType: 5
-videoUrl: ''
+forumTopicId: 302286
dashedName: hofstadter-figure-figure-sequences
---
# --description--
-这两个正整数序列定义为:
$$ R(1)= 1 \; \ S(1)= 2 \\ R(n)= R(n-1)+ S(n-1),\ quad n> 1. $$
序列$ S(n)$进一步定义为$ R(n)$中不存在的正整数序列。
序列$ R $开始:
1,3,7,12,18 ......
序列$ S $开始:
2,4,5,6,8 ......
任务:创建两个名为ffr和ffs的函数,当给定n分别返回R(n)或S(n)时(注意R(1)= 1且S(1)= 2以避免逐个错误) 。不应假设n的最大值。 Sloane的A005228和A030124 。 Wolfram MathWorld维基百科: Hofstadter图 - 图序列 。
+These two sequences of positive integers are defined as:
+
+$R(1)=1\\ ;\\ S(1)=2 \\\\R(n)=R(n-1)+S(n-1), \\quad n>1.$
+
+The sequence $S(n)$ is further defined as the sequence of positive integers not present in $R(n)$.
+
+Sequence $R$ starts:
+
+1, 3, 7, 12, 18, ...
+
+Sequence $S$ starts:
+
+2, 4, 5, 6, 8, ...
+
+# --instructions--
+
+Create two functions named `ffr` and `ffs` that when given `n` return `R(n)` or `S(n)` respectively. (Note that R(1) = 1 and S(1) = 2 to avoid off-by-one errors).
+
+No maximum value for `n` should be assumed.
+
+**References**
+
+
# --hints--
-`ffr`是一个功能。
+`ffr` should be a function.
```js
assert(typeof ffr === 'function');
```
-`ffs`是一个函数。
+`ffs` should be a function.
```js
assert(typeof ffs === 'function');
```
-`ffr`应该返回整数。
+`ffr` should return integer.
```js
assert(Number.isInteger(ffr(1)));
```
-`ffs`应该返回整数。
+`ffs` should return integer.
```js
assert(Number.isInteger(ffs(1)));
```
-`ffr()`应该返回`69`
+`ffr(10)` should return `69`
```js
assert.equal(ffr(ffrParamRes[0][0]), ffrParamRes[0][1]);
```
-`ffr()`应返回`1509`
+`ffr(50)` should return `1509`
```js
assert.equal(ffr(ffrParamRes[1][0]), ffrParamRes[1][1]);
```
-`ffr()`应返回`5764`
+`ffr(100)` should return `5764`
```js
assert.equal(ffr(ffrParamRes[2][0]), ffrParamRes[2][1]);
```
-`ffr()`应返回`526334`
+`ffr(1000)` should return `526334`
```js
assert.equal(ffr(ffrParamRes[3][0]), ffrParamRes[3][1]);
```
-`ffs()`应该返回`14`
+`ffs(10)` should return `14`
```js
assert.equal(ffs(ffsParamRes[0][0]), ffsParamRes[0][1]);
```
-`ffs()`应该返回`59`
+`ffs(50)` should return `59`
```js
assert.equal(ffs(ffsParamRes[1][0]), ffsParamRes[1][1]);
```
-`ffs()`应该返回`112`
+`ffs(100)` should return `112`
```js
assert.equal(ffs(ffsParamRes[2][0]), ffsParamRes[2][1]);
```
-`ffs()`应该返回`1041`
+`ffs(1000)` should return `1041`
```js
assert.equal(ffs(ffsParamRes[3][0]), ffsParamRes[3][1]);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hofstadter-q-sequence.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hofstadter-q-sequence.md
index 49b9557ca89..c8ab7d438ce 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hofstadter-q-sequence.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/hofstadter-q-sequence.md
@@ -1,48 +1,56 @@
---
id: 59637c4d89f6786115efd814
-title: Hofstadter Q序列
+title: Hofstadter Q sequence
challengeType: 5
-videoUrl: ''
+forumTopicId: 302287
dashedName: hofstadter-q-sequence
---
# --description--
- Hofstadter Q序列定义为:
$ Q(1)= Q(2)= 1,\\ Q(n)= Q \ big(nQ(n-1)\ big)+ Q \ big(nQ(n-2)),\ quad n> 2. $
它定义为Fibonacci序列 ,但Fibonacci序列中的下一个术语是前两个术语的总和,在Q序列中,前两个术语告诉您在Q序列中返回多远以找到两个数字总结以制作序列的下一个术语。
任务:将Hofstadter Q Sequence方程实现为JavaScript
+The [Hofstadter Q sequence](https://en.wikipedia.org/wiki/Hofstadter_sequence#Hofstadter_Q_sequence "wp: Hofstadter_sequence#Hofstadter_Q_sequence") is defined as:
+
+$Q(1)=Q(2)=1, \\\\ Q(n)=Q\\big(n-Q(n-1)\\big)+Q\\big(n-Q(n-2)), \\quad n>2.$
+
+It is defined like the [Fibonacci sequence](https://rosettacode.org/wiki/Fibonacci sequence "Fibonacci sequence"), but whereas the next term in the Fibonacci sequence is the sum of the previous two terms, in the Q sequence the previous two terms tell you how far to go back in the Q sequence to find the two numbers to sum to make the next term of the sequence.
+
+# --instructions--
+
+Implement the Hofstadter Q Sequence equation as a function. The function should accept number, `n`, and return an integer.
# --hints--
-`hofstadterQ`是一个函数。
+`hofstadterQ` should be a function.
```js
assert(typeof hofstadterQ === 'function');
```
-`hofstadterQ()`应该返回`integer`
+`hofstadterQ()` should return `integer`
```js
assert(Number.isInteger(hofstadterQ(1000)));
```
-`hofstadterQ(1000)`应该返回`502`
+`hofstadterQ(1000)` should return `502`
```js
assert.equal(hofstadterQ(testCase[0]), res[0]);
```
-`hofstadterQ(1500)`应该返回`755`
+`hofstadterQ(1500)` should return `755`
```js
assert.equal(hofstadterQ(testCase[1]), res[1]);
```
-`hofstadterQ(2000)`应该返回`1005`
+`hofstadterQ(2000)` should return `1005`
```js
assert.equal(hofstadterQ(testCase[2]), res[2]);
```
-`hofstadterQ(2500)`应该返回`1261`
+`hofstadterQ(2500)` should return `1261`
```js
assert.equal(hofstadterQ(testCase[3]), res[3]);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/i-before-e-except-after-c.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/i-before-e-except-after-c.md
index c82bf3244ee..afac6dc5121 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/i-before-e-except-after-c.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/i-before-e-except-after-c.md
@@ -1,65 +1,77 @@
---
id: 5a23c84252665b21eecc7eb0
-title: 我在E之前除了C之后
+title: I before E except after C
challengeType: 5
-videoUrl: ''
+forumTopicId: 302288
dashedName: i-before-e-except-after-c
---
# --description--
-短语[“我在E之前,除了C之后”]()是一个广为人知的助记符,它应该有助于拼写英语单词。使用提供的单词,检查短语的两个子句是否合理:
+The phrase ["I before E, except after C"](https://en.wikipedia.org/wiki/I before E except after C) is a widely known mnemonic which is supposed to help when spelling English words.
-1. *“我在E之前没有前面的C”。*
-2. *“在我之前的C之前是C”。*
+Using the words provided, check if the two sub-clauses of the phrase are plausible individually:
-如果两个子短语都是合理的,则原始短语可以说是合理的。编写一个接受单词的函数,并检查单词是否遵循此规则。如果该函数遵循规则,则该函数应返回true,否则返回false。
+
+ -
+ "I before E when not preceded by C".
+
+ -
+ "E before I when preceded by C".
+
+
+
+If both sub-phrases are plausible then the original phrase can be said to be plausible.
+
+# --instructions--
+
+Write a function that accepts a word and check if the word follows this rule. The function should return true if the word follows the rule and false if it does not.
# --hints--
-`IBeforeExceptC`应该是一个函数。
+`IBeforeExceptC` should be a function.
```js
assert(typeof IBeforeExceptC == 'function');
```
-`IBeforeExceptC("receive")`应该返回一个布尔值。
+`IBeforeExceptC("receive")` should return a boolean.
```js
assert(typeof IBeforeExceptC('receive') == 'boolean');
```
-`IBeforeExceptC("receive")`应该返回`true` 。
+`IBeforeExceptC("receive")` should return `true`.
```js
assert.equal(IBeforeExceptC('receive'), true);
```
-`IBeforeExceptC("science")`应该返回`false` 。
+`IBeforeExceptC("science")` should return `false`.
```js
assert.equal(IBeforeExceptC('science'), false);
```
-`IBeforeExceptC("imperceivable")`应该返回`true` 。
+`IBeforeExceptC("imperceivable")` should return `true`.
```js
assert.equal(IBeforeExceptC('imperceivable'), true);
```
-`IBeforeExceptC("inconceivable")`应该返回`true` 。
+`IBeforeExceptC("inconceivable")` should return `true`.
```js
assert.equal(IBeforeExceptC('inconceivable'), true);
```
-`IBeforeExceptC("insufficient")`应返回`false` 。
+`IBeforeExceptC("insufficient")` should return `false`.
```js
assert.equal(IBeforeExceptC('insufficient'), false);
```
-`IBeforeExceptC("omniscient")`应该返回`false` 。
+`IBeforeExceptC("omniscient")` should return `false`.
```js
assert.equal(IBeforeExceptC('omniscient'), false);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/iban.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/iban.md
index 9fd6e2526d9..666c50a6be8 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/iban.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/iban.md
@@ -1,60 +1,68 @@
---
id: 5a23c84252665b21eecc7eaf
-title: 他们
+title: IBAN
challengeType: 5
-videoUrl: ''
+forumTopicId: 302289
dashedName: iban
---
# --description--
-[国际银行账号(IBAN)](https://en.wikipedia.org/wiki/International_Bank_Account_Number)是一种国际商定的识别跨国界银行账户的方法,降低了传播[抄写错误的](https://en.wikipedia.org/wiki/Transcription_error)风险。 IBAN最多包含34个字母数字字符:
+The [International Bank Account Number (IBAN)](https://en.wikipedia.org/wiki/International_Bank_Account_Number) is an internationally agreed means of identifying bank accounts across national borders with a reduced risk of propagating [transcription errors](https://en.wikipedia.org/wiki/Transcription_error).
-- 首先是两个字母的ISO 3166-1 alpha-2国家代码
-- 然后是两个校验位,和
-- 最后是国家特定的基本银行帐号(BBAN)。
+The IBAN consists of up to 34 alphanumeric characters:
-通过检查数字,即使在提交交易之前,也可以对银行帐号进行健全性检查以确认其完整性。编写一个以IBAN字符串作为参数的函数。如果有效则返回true。否则,返回false。
+
+ - first the two-letter ISO 3166-1 alpha-2 country code
+ - then two check digits, and
+ - finally a country-specific Basic Bank Account Number (BBAN).
+
+
+The check digits enable a sanity check of the bank account number to confirm its integrity even before submitting a transaction.
+
+# --instructions--
+
+Write a function that takes IBAN string as parameter. If it is valid return true. Otherwise, return false.
# --hints--
-`isValid`应该是一个函数。
+`isValid` should be a function.
```js
assert(typeof isValid == 'function');
```
-`isValid(""+tests[0]+"")`应该返回一个布尔值。
+`isValid("GB82 WEST 1234 5698 7654 32")` should return a boolean.
```js
assert(typeof isValid('GB82 WEST 1234 5698 7654 32') == 'boolean');
```
-`isValid(""+tests[0]+"")`应该返回`true` 。
+`isValid("GB82 WEST 1234 5698 7654 32")` should return `true`.
```js
assert.equal(isValid('GB82 WEST 1234 5698 7654 32'), true);
```
-`isValid(""+tests[1]+"")`应返回`false` 。
+`isValid("GB82 WEST 1.34 5698 7654 32")` should return `false`.
```js
assert.equal(isValid('GB82 WEST 1.34 5698 7654 32'), false);
```
-`isValid(""+tests[2]+"")`应返回`false` 。
+`isValid("GB82 WEST 1234 5698 7654 325")` should return `false`.
```js
assert.equal(isValid('GB82 WEST 1234 5698 7654 325'), false);
```
-`isValid(""+tests[3]+"")`应该返回`false` 。
+`isValid("GB82 TEST 1234 5698 7654 32")` should return `false`.
```js
assert.equal(isValid('GB82 TEST 1234 5698 7654 32'), false);
```
-`isValid(""+tests[4]+"")`应该返回`true` 。
+`isValid("SA03 8000 0000 6080 1016 7519")` should return `true`.
```js
assert.equal(isValid('SA03 8000 0000 6080 1016 7519'), true);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/identity-matrix.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/identity-matrix.md
index c9b640e8985..a8465da648c 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/identity-matrix.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/identity-matrix.md
@@ -1,48 +1,56 @@
---
id: 5a23c84252665b21eecc7eb1
-title: 身份矩阵
+title: Identity matrix
challengeType: 5
-videoUrl: ''
+forumTopicId: 302290
dashedName: identity-matrix
---
# --description--
-*单位矩阵*是大小为\\(n \\次n \\)的方阵,其中对角元素都是**1** s(1),所有其他元素都是**0** s(零)。 \\ begin {bmatrix} 1&0&0 \\ cr 0&1&0 \\ cr 0&0&1 \\ cr \\ end {bmatrix}编写一个以数字'n'作为参数并返回单位矩阵的函数订单nx n。
+An *identity matrix* is a square matrix of size \\( n \\times n \\), where the diagonal elements are all `1`s (ones), and all the other elements are all `0`s (zeroes).
+
+
+ - \(\displaystyle I_{n}=\begin{bmatrix} 1 & 0 & 0 \cr 0 & 1 & 0 \cr 0 & 0 & 1 \cr \end{bmatrix}\)
+
+
+# --instructions--
+
+Write a function that takes a number `n` as a parameter and returns the identity matrix of order \\( n \\times n \\).
# --hints--
-`idMatrix`应该是一个功能。
+`idMatrix` should be a function.
```js
assert(typeof idMatrix == 'function');
```
-`idMatrix(1)`应该返回一个数组。
+`idMatrix(1)` should return an array.
```js
assert(Array.isArray(idMatrix(1)));
```
-`idMatrix(1)`应返回`"+JSON.stringify(results[0])+"` 。
+`idMatrix(1)` should return `[ [ 1 ] ]`.
```js
assert.deepEqual(idMatrix(1), results[0]);
```
-`idMatrix(2)`应返回`"+JSON.stringify(results[1])+"` 。
+`idMatrix(2)` should return `[ [ 1, 0 ], [ 0, 1 ] ]`.
```js
assert.deepEqual(idMatrix(2), results[1]);
```
-`idMatrix(3)`应返回`"+JSON.stringify(results[2])+"` 。
+`idMatrix(3)` should return `[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ]`.
```js
assert.deepEqual(idMatrix(3), results[2]);
```
-`idMatrix(4)`应返回`"+JSON.stringify(results[3])+"` 。
+`idMatrix(4)` should return `[ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ]`.
```js
assert.deepEqual(idMatrix(4), results[3]);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/iterated-digits-squaring.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/iterated-digits-squaring.md
index 304a24e2c07..bbed591151a 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/iterated-digits-squaring.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/iterated-digits-squaring.md
@@ -1,67 +1,68 @@
---
id: 5a23c84252665b21eecc7ec1
-title: 迭代的数字平方
+title: Iterated digits squaring
challengeType: 5
-videoUrl: ''
+forumTopicId: 302291
dashedName: iterated-digits-squaring
---
# --description--
-如果添加自然数(大于零的整数)的数字的平方,则始终以1或89结尾:
+If you add the square of the digits of a Natural number (an integer bigger than zero), you always end with either 1 or 89:
-```
- 15 - > 26 - > 40 - > 16 - > 37 - > 58 - > 89
-7 - > 49 - > 97 - > 130 - > 10 - > 1
-```
+15 -> 26 -> 40 -> 16 -> 37 -> 58 -> 89
+7 -> 49 -> 97 -> 130 -> 10 -> 1
+
-编写一个函数,该函数将数字作为参数,并在执行上述过程后返回1或89。
+# --instructions--
+
+Write a function that takes a number as a parameter and returns 1 or 89 after performing the mentioned process.
# --hints--
-`iteratedSquare`应该是一个函数。
+`iteratedSquare` should be a function.
```js
assert(typeof iteratedSquare == 'function');
```
-`iteratedSquare(4)`应该返回一个数字。
+`iteratedSquare(4)` should return a number.
```js
assert(typeof iteratedSquare(4) == 'number');
```
-`iteratedSquare(4)`应该返回`89` 。
+`iteratedSquare(4)` should return `89`.
```js
assert.equal(iteratedSquare(4), 89);
```
-`iteratedSquare(7)`应该返回`1` 。
+`iteratedSquare(7)` should return `1`.
```js
assert.equal(iteratedSquare(7), 1);
```
-`iteratedSquare(15)`应该返回`89` 。
+`iteratedSquare(15)` should return `89`.
```js
assert.equal(iteratedSquare(15), 89);
```
-`iteratedSquare(20)`应该返回`89` 。
+`iteratedSquare(20)` should return `89`.
```js
assert.equal(iteratedSquare(20), 89);
```
-`iteratedSquare(70)`应该返回`1` 。
+`iteratedSquare(70)` should return `1`.
```js
assert.equal(iteratedSquare(70), 1);
```
-`iteratedSquare(100)`应该返回`1` 。
+`iteratedSquare(100)` should return `1`.
```js
assert.equal(iteratedSquare(100), 1);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/jaro-distance.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/jaro-distance.md
index b8f506b716e..d348acaee73 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/jaro-distance.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/jaro-distance.md
@@ -1,66 +1,88 @@
---
id: 5a23c84252665b21eecc7ec2
-title: Jaro距离
+title: Jaro distance
challengeType: 5
-videoUrl: ''
+forumTopicId: 302292
dashedName: jaro-distance
---
# --description--
-Jaro距离是两个弦之间相似性的度量。两个弦的Jaro距离越高,弦越相似。对得分进行归一化,使得**0**等于没有相似性, **1**等于完全匹配。定义两个给定字符串\\(s_1 \\)和\\(s_2 \\)的Jaro距离\\(d_j \\)是\\ begin {align} d_j = \\ begin {cases} 0 && \\ text {if} m = 0 \\\\\\ \\ {\\ frac {1} {3}} \\ left({\\ frac {m} {| s\_ {1} |}} + {\\ frac {m} {| s\_ {2} |}} + {\\ frac { mt} {m}} \\ right)&& \\ text {otherwise} \\ end {cases} \\ end {align}其中:
+The Jaro distance is a measure of similarity between two strings. The higher the Jaro distance for two strings is, the more similar the strings are. The score is normalized such that `0` equates to no similarity and `1` is an exact match.
-- \\(m \\)是*匹配字符*的数量;
-- \\(t \\)是*换位*次数的一半。
+**Definition**
-分别来自\\(s_1 \\)和\\(s_2 \\)的两个字符只有在相同且不远于\\(\\ left \\ lfloor \\ frac {\\ max(| s_1 |,| s_2 |)}时才被认为是*匹配的* {2} \\右\\ rfloor-1 \\)。将\\(s_1 \\)的每个字符与\\(s_2 \\)中的所有匹配字符进行比较。匹配(但不同的序列顺序)字符除以2的数量定义了*转置*的数量。 **示例**给定字符串\\(s_1 \\) *DWAYNE*和\\(s_2 \\) *DUANE*我们发现:
+The Jaro distance \\( d_j \\) of two given strings \\(s_1\\) and \\(s_2\\) is
-- \\(m = 4 \\)
-- \\(| s_1 | = 6 \\)
-- \\(| s_2 | = 5 \\)
-- \\(t = 0 \\)
+\\begin{align}d_j = \\begin{cases}0& & \\text{if }m=0 \\\\\\\\{\\frac {1}{3}}\\left({\\frac {m}{|s\_{1}|}}+{\\frac {m}{|s\_{2}|}}+{\\frac {m-t}{m}}\\right)& & \\text{otherwise}\\end{cases}\\end{align}
-我们发现Jaro得分为:\\(d_j = \\ frac {1} {3} \\ left(\\ frac {4} {6} + \\ frac {4} {5} + \\ frac {4-0} {4} \\ right)= 0.822 \\)。编写一个函数a,它接受两个字符串作为参数并返回相关的Jaro距离。
+Where:
+
+
+ - \(m\) is the number of matching characters;
+ - \(t\) is half the number of transpositions.
+
+
+Two characters from \\(s_1\\) and \\(s_2\\) respectively, are considered *matching* only if they are the same and not farther than \\(\\left\\lfloor\\frac{\\max(|s_1|,|s_2|)}{2}\\right\\rfloor-1\\).
+
+Each character of \\(s_1\\) is compared with all its matching characters in \\(s_2\\) . The number of matching (but different sequence order) characters divided by 2 defines the number of *transpositions*.
+
+**Example**
+
+Given the strings \\(s_1\\) *DWAYNE* and \\(s_2\\) *DUANE* we find:
+
+
+ - \(m = 4\)
+ - \(|s_1| = 6\)
+ - \(|s_2| = 5\)
+ - \(t = 0\)
+
+
+We find a Jaro score of: \\(d_j = \\frac{1}{3}\\left(\\frac{4}{6} + \\frac{4}{5} + \\frac{4-0}{4}\\right) = 0.822\\).
+
+# --instructions--
+
+Write a function a that takes two strings as parameters and returns the associated Jaro distance.
# --hints--
-`jaro`应该是一个功能。
+`jaro` should be a function.
```js
assert(typeof jaro == 'function');
```
-`jaro(""+tests[0][0]+"",""+tests[0][1]+"")`应返回一个数字。
+`jaro("MARTHA", "MARHTA")` should return a number.
```js
assert(typeof jaro('MARTHA', 'MARHTA') == 'number');
```
-`jaro(""+tests[0][0]+"",""+tests[0][1]+"")`应该返回`"+results[0]+"` 。
+`jaro("MARTHA", "MARHTA")` should return `0.9444444444444445`.
```js
assert.equal(jaro('MARTHA', 'MARHTA'), 0.9444444444444445);
```
-`jaro(""+tests[1][0]+"",""+tests[1][1]+"")`应返回`"+results[1]+"` 。
+`jaro("DIXON", "DICKSONX")` should return `0.7666666666666666`.
```js
assert.equal(jaro('DIXON', 'DICKSONX'), 0.7666666666666666);
```
-`jaro(""+tests[2][0]+"",""+tests[2][1]+"")`应返回`"+results[2]+"` 。
+`jaro("JELLYFISH", "SMELLYFISH")` should return `0.8962962962962964`.
```js
assert.equal(jaro('JELLYFISH', 'SMELLYFISH'), 0.8962962962962964);
```
-`jaro(""+tests[3][0]+"",""+tests[3][1]+"")`应返回`"+results[3]+"` 。
+`jaro("HELLOS", "CHELLO")` should return `0.888888888888889`.
```js
assert.equal(jaro('HELLOS', 'CHELLO'), 0.888888888888889);
```
-`jaro(""+tests[4][0]+"",""+tests[4][1]+"")`应该返回`"+results[4]+"` 。
+`jaro("ABCD", "BCDA")` should return `0.8333333333333334`.
```js
assert.equal(jaro('ABCD', 'BCDA'), 0.8333333333333334);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/jortsort.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/jortsort.md
index 186cafa3d5f..0f121b99ee4 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/jortsort.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/jortsort.md
@@ -2,59 +2,61 @@
id: 5a23c84252665b21eecc7ec4
title: JortSort
challengeType: 5
-videoUrl: ''
+forumTopicId: 302293
dashedName: jortsort
---
# --description--
-jortSort是一个排序工具集,它使用户可以完成工作并保证效率,因为您不必再次排序。它最初是由着名的[JSConf的](https://www.youtube.com/watch?v=pj4U_W0OFoE) Jenn“Moneydollars”Schiffer [提出的](https://www.youtube.com/watch?v=pj4U_W0OFoE) 。 jortSort是一个函数,它将一个可比较对象数组作为其参数。然后它按升序对数组进行排序,并将排序后的数组与最初提供的数组进行比较。如果数组匹配(即原始数组已经排序),则该函数返回true。如果数组不匹配(即原始数组未排序),则该函数返回false。
+jortSort is a sorting toolset that makes the user do the work and guarantees efficiency because you don't have to sort ever again. It was originally presented by Jenn "Moneydollars" Schiffer at the prestigious [JSConf](https://www.youtube.com/watch?v=pj4U_W0OFoE).
+
+jortSort should be a function that takes a single array of comparable objects as its argument. It then sorts the array in ascending order and compares the sorted array to the originally provided array. If the arrays match (i.e. the original array was already sorted), the function returns true. If the arrays do not match (i.e. the original array was not sorted), the function returns false.
# --hints--
-`jortsort`应该是一个功能。
+`jortsort` should be a function.
```js
assert(typeof jortsort == 'function');
```
-`jortsort("+JSON.stringify(tests[0])+")`应该返回一个布尔值。
+`jortsort([1,2,3,4,5])` should return a boolean.
```js
assert(typeof jortsort([1, 2, 3, 4, 5]) == 'boolean');
```
-`jortsort("+JSON.stringify(tests[0])+")`应该返回`true` 。
+`jortsort([1,2,3,4,5])` should return `true`.
```js
assert.equal(jortsort([1, 2, 3, 4, 5]), true);
```
-`jortsort("+JSON.stringify(tests[1])+")`应该返回`false` 。
+`jortsort([1,2,13,4,5])` should return `false`.
```js
assert.equal(jortsort([1, 2, 13, 4, 5]), false);
```
-`jortsort("+JSON.stringify(tests[2])+")`应该返回`false` 。
+`jortsort([12,4,51,2,4])` should return `false`.
```js
assert.equal(jortsort([12, 4, 51, 2, 4]), false);
```
-`jortsort("+JSON.stringify(tests[3])+")`应该返回`true` 。
+`jortsort([1,2])` should return `true`.
```js
assert.equal(jortsort([1, 2]), true);
```
-`jortsort("+JSON.stringify(tests[4])+")`应该返回`false` 。
+`jortsort([5,4,3,2,1])` should return `false`.
```js
assert.equal(jortsort([5, 4, 3, 2, 1]), false);
```
-`jortsort("+JSON.stringify(tests[5])+")`应该返回`true` 。
+`jortsort([1,1,1,1,1])` should return `true`.
```js
assert.equal(jortsort([1, 1, 1, 1, 1]), true);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/josephus-problem.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/josephus-problem.md
index f467ebe8a71..93d7f7876b6 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/josephus-problem.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/josephus-problem.md
@@ -1,54 +1,72 @@
---
id: 5a23c84252665b21eecc7ec5
-title: 约瑟夫斯问题
+title: Josephus problem
challengeType: 5
-videoUrl: ''
+forumTopicId: 302294
dashedName: josephus-problem
---
# --description--
-[约瑟夫斯问题]()是一个严峻描述的数学难题:$ n $囚犯站在一个圆圈上,顺序编号从$ 0 $到$ n-1 $。一名刽子手沿着圈子走,从囚犯$ 0 $开始,移走每个$ k $囚犯并杀死他。随着过程的继续,圆圈变得越来越小,直到只剩下一个囚犯,然后被释放。例如,如果$ n = 5 $囚犯和$ k = 2 $,囚犯被杀的命令(我们称之为“杀戮序列”)将是1,3,0和4,幸存者将是#2。鉴于任何$ n,k> 0 $ ,找出哪个囚犯将成为最后的幸存者。在一个这样的事件中,有41个囚犯和每3 次囚犯被杀死($ K = 3 $)。其中有一个聪明的名字约瑟夫斯,他解决了这个问题,站在幸存的位置,并继续讲述这个故事。他是哪个号码?写一个函数,以囚犯的初始数量和'k'作为参数,并返回幸存的囚犯的数量。
+[Josephus problem](https://en.wikipedia.org/wiki/Josephus problem) is a math puzzle with a grim description: $n$ prisoners are standing on a circle, sequentially numbered from $0$ to $n-1$.
+
+An executioner walks along the circle, starting from prisoner $0$, removing every $k$-th prisoner and killing him.
+
+As the process goes on, the circle becomes smaller and smaller, until only one prisoner remains, who is then freed.
+
+For example, if there are $n=5$ prisoners and $k=2$, the order the prisoners are killed in (let's call it the "killing sequence") will be 1, 3, 0, and 4, and the survivor will be #2.
+
+Given any $n, k > 0$, find out which prisoner will be the final survivor.
+
+In one such incident, there were 41 prisoners and every 3rd prisoner was being killed ($k=3$).
+
+Among them was a clever chap name Josephus who worked out the problem, stood at the surviving position, and lived on to tell the tale.
+
+Which number was he?
+
+# --instructions--
+
+Write a function that takes the initial number of prisoners and 'k' as parameter and returns the number of the prisoner that survives.
# --hints--
-`josephus`应该是一个功能。
+`josephus` should be a function.
```js
assert(typeof josephus == 'function');
```
-`josephus(30,3)`应该返回一个数字。
+`josephus(30,3)` should return a number.
```js
assert(typeof josephus(30, 3) == 'number');
```
-`josephus(30,3)`应该回`29` 。
+`josephus(30,3)` should return `29`.
```js
assert.equal(josephus(30, 3), 29);
```
-`josephus(30,5)`应该返回`3` 。
+`josephus(30,5)` should return `3`.
```js
assert.equal(josephus(30, 5), 3);
```
-`josephus(20,2)`应该返回`9` 。
+`josephus(20,2)` should return `9`.
```js
assert.equal(josephus(20, 2), 9);
```
-`josephus(17,6)`应该回归`2` 。
+`josephus(17,6)` should return `2`.
```js
assert.equal(josephus(17, 6), 2);
```
-`josephus(29,4)`应该返回`2` 。
+`josephus(29,4)` should return `2`.
```js
assert.equal(josephus(29, 4), 2);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/kaprekar-numbers.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/kaprekar-numbers.md
index 59e368bc527..7b2530f4c62 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/kaprekar-numbers.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/kaprekar-numbers.md
@@ -8,7 +8,7 @@ dashedName: kaprekar-numbers
# --description--
-A positive integer is a [Kaprekar number]() if:
+A positive integer is a [Kaprekar number](https://en.wikipedia.org/wiki/Kaprekar number) if:
- It is 1, or,
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/least-common-multiple.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/least-common-multiple.md
index 403e448d2f4..aa27446cbe9 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/least-common-multiple.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/least-common-multiple.md
@@ -8,7 +8,7 @@ dashedName: least-common-multiple
# --description--
-The least common multiple of 12 and 18 is 36, because 12 is a factor (12 × 3 = 36), and 18 is a factor (18 × 2 = 36), and there is no positive integer less than 36 that has both factors. As a special case, if either *m* or *n* is zero, then the least common multiple is zero. One way to calculate the least common multiple is to iterate all the multiples of *m*, until you find one that is also a multiple of *n*. If you already have *gcd* for [greatest common divisor](), then this formula calculates *lcm*. ( \\operatorname{lcm}(m, n) = \\frac{|m \\times n|}{\\operatorname{gcd}(m, n)} )
+The least common multiple of 12 and 18 is 36, because 12 is a factor (12 × 3 = 36), and 18 is a factor (18 × 2 = 36), and there is no positive integer less than 36 that has both factors. As a special case, if either *m* or *n* is zero, then the least common multiple is zero. One way to calculate the least common multiple is to iterate all the multiples of *m*, until you find one that is also a multiple of *n*. If you already have *gcd* for [greatest common divisor](https://rosettacode.org/wiki/greatest common divisor), then this formula calculates *lcm*. ( \\operatorname{lcm}(m, n) = \\frac{|m \\times n|}{\\operatorname{gcd}(m, n)} )
# --instructions--
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/levenshtein-distance.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/levenshtein-distance.md
index 104543d9d00..2737ad5436a 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/levenshtein-distance.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/levenshtein-distance.md
@@ -8,7 +8,7 @@ dashedName: levenshtein-distance
# --description--
-In information theory and computer science, the **Levenshtein distance** is a [metric]() for measuring the amount of difference between two sequences (i.e. an [edit distance]()). The Levenshtein distance between two strings is defined as the minimum number of edits needed to transform one string into the other, with the allowable edit operations being insertion, deletion, or substitution of a single character.
+In information theory and computer science, the **Levenshtein distance** is a [metric](https://en.wikipedia.org/wiki/string metric) for measuring the amount of difference between two sequences (i.e. an [edit distance](https://en.wikipedia.org/wiki/edit distance)). The Levenshtein distance between two strings is defined as the minimum number of edits needed to transform one string into the other, with the allowable edit operations being insertion, deletion, or substitution of a single character.
Example:
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/linear-congruential-generator.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/linear-congruential-generator.md
index 24e89f42e62..0448399ccbe 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/linear-congruential-generator.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/linear-congruential-generator.md
@@ -8,9 +8,9 @@ dashedName: linear-congruential-generator
# --description--
-The [linear congruential generator]() is a very simple example of a [random number generator](). All linear congruential generators use this formula:
+The [linear congruential generator](https://en.wikipedia.org/wiki/linear congruential generator) is a very simple example of a [random number generator](http://rosettacode.org/wiki/random number generator). All linear congruential generators use this formula:
-$$r\_{n + 1} = a \\times r_n + c \\pmod m$$
+$$r_{n + 1} = (a \times r_n + c) \bmod m$$
Where:
@@ -22,7 +22,7 @@ Where:
If one chooses the values of $a$, $c$ and $m$ with care, then the generator produces a uniform distribution of integers from $0$ to $m - 1$.
-LCG numbers have poor quality. $r_n$ and $r\_{n + 1}$ are not independent, as true random numbers would be. Anyone who knows $r_n$ can predict $r\_{n + 1}$, therefore LCG is not cryptographically secure. The LCG is still good enough for simple tasks like [Miller-Rabin primality test](), or [FreeCell deals](). Among the benefits of the LCG, one can easily reproduce a sequence of numbers, from the same $r_0$. One can also reproduce such sequence with a different programming language, because the formula is so simple.
+LCG numbers have poor quality. $r_n$ and $r\_{n + 1}$ are not independent, as true random numbers would be. Anyone who knows $r_n$ can predict $r\_{n + 1}$, therefore LCG is not cryptographically secure. The LCG is still good enough for simple tasks like [Miller-Rabin primality test](http://rosettacode.org/wiki/Miller-Rabin primality test), or [FreeCell deals](http://rosettacode.org/wiki/deal cards for FreeCell). Among the benefits of the LCG, one can easily reproduce a sequence of numbers, from the same $r_0$. One can also reproduce such sequence with a different programming language, because the formula is so simple.
# --instructions--
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/long-multiplication.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/long-multiplication.md
index 431f88eeb8f..fb4e2456cf3 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/long-multiplication.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/long-multiplication.md
@@ -8,7 +8,7 @@ dashedName: long-multiplication
# --description--
-Explicitly implement [long multiplication]().
+Explicitly implement [long multiplication](https://en.wikipedia.org/wiki/long multiplication).
This is one possible approach to arbitrary-precision integer algebra.
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/longest-increasing-subsequence.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/longest-increasing-subsequence.md
index 4de5521d55f..0ba5661f6c8 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/longest-increasing-subsequence.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/longest-increasing-subsequence.md
@@ -18,7 +18,7 @@ Longest increasing sequence is:
$\\{3, 10, 20\\}$
-For more information on this problem please see [Wikipedia]().
+For more information on this problem please see [Wikipedia](https://en.wikipedia.org/wiki/Longest increasing subsequence).
# --instructions--
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/look-and-say-sequence.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/look-and-say-sequence.md
index 073e41920d5..ed09269a091 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/look-and-say-sequence.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/look-and-say-sequence.md
@@ -8,7 +8,7 @@ dashedName: look-and-say-sequence
# --description--
-The [Look and say sequence]() is a recursively defined sequence of numbers.
+The [Look and say sequence](https://en.wikipedia.org/wiki/Look and say sequence) is a recursively defined sequence of numbers.
Sequence Definition
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/lu-decomposition.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/lu-decomposition.md
index f7a900174ec..1b2442f3056 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/lu-decomposition.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/lu-decomposition.md
@@ -8,13 +8,13 @@ dashedName: lu-decomposition
# --description--
-Every square matrix $A$ can be decomposed into a product of a lower triangular matrix $L$ and a upper triangular matrix $U$, as described in [LU decomposition]().
+Every square matrix $A$ can be decomposed into a product of a lower triangular matrix $L$ and a upper triangular matrix $U$, as described in [LU decomposition](https://en.wikipedia.org/wiki/LU decomposition).
$A = LU$
It is a modified form of Gaussian elimination.
-While the [Cholesky decomposition]() only works for symmetric, positive definite matrices, the more general LU decomposition works for any square matrix.
+While the [Cholesky decomposition](http://rosettacode.org/wiki/Cholesky decomposition) only works for symmetric, positive definite matrices, the more general LU decomposition works for any square matrix.
There are several algorithms for calculating $L$ and $U$.
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/luhn-test-of-credit-card-numbers.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/luhn-test-of-credit-card-numbers.md
index 0a44e1da794..4fcc90502ab 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/luhn-test-of-credit-card-numbers.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/luhn-test-of-credit-card-numbers.md
@@ -8,7 +8,7 @@ dashedName: luhn-test-of-credit-card-numbers
# --description--
-The [Luhn test]() is used by some credit card companies to distinguish valid credit card numbers from what could be a random selection of digits.
+The [Luhn test](https://en.wikipedia.org/wiki/Luhn algorithm) is used by some credit card companies to distinguish valid credit card numbers from what could be a random selection of digits.
Those companies using credit card numbers that can be validated by the Luhn test have numbers that pass the following test:
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/lzw-compression.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/lzw-compression.md
index d408984b6a6..ccde98aa946 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/lzw-compression.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/lzw-compression.md
@@ -14,7 +14,7 @@ You can read a complete description of it in the [Wikipedia article](https://en.
# --instructions--
-Write a function that takes two parameters. The first parameter is a boolean where \`true\` indicates compress and \`false\` indicates decompress. The second parameter is either a string or an array to be processed. If it is a string to be compressed, return an array of numbers. If it's an array of numbers to be decompressed, return a string.
+Write a function that takes two parameters. The first parameter is a boolean where `true` indicates compress and `false` indicates decompress. The second parameter is either a string or an array to be processed. If it is a string to be compressed, return an array of numbers. If it's an array of numbers to be decompressed, return a string.
# --hints--
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/s-expressions.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/s-expressions.md
index 433e8929ee4..e7ed94741c6 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/s-expressions.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/s-expressions.md
@@ -1,32 +1,54 @@
---
id: 59667989bf71cf555dd5d2ff
-title: S-表达式
+title: S-Expressions
challengeType: 5
-videoUrl: ''
+forumTopicId: 302303
dashedName: s-expressions
---
# --description--
- S-Expressions是一种解析和存储数据的便捷方式。
任务: 为S-Expressions编写一个简单的读取器/解析器,处理引用的和不带引号的字符串,整数和浮点数。
该函数应从字符串中读取单个但嵌套的S-Expression,并将其作为(嵌套)数组返回。
除非包含在带引号的字符串中,否则可以忽略换行符和其他空格。
“ () ”内部引用的字符串不会被解释,但会被视为字符串的一部分。
处理字符串中的转义引号是可选的;因此“ (foo”bar) “可能被视为字符串” foo“bar ”,或作为错误。
为此,读者无需识别“ \ ”以进行转义,但如果语言具有适当的数据类型,则还应识别数字。
请注意,除了“ ()” “(” \ “,如果支持转义)和空格,没有特殊字符。其他任何内容都是允许的,不带引号。
读者应该能够阅读以下输入
((数据“引用数据”123 4.5)
- (数据(!@#(4.5)“(更多”“数据”))))
-
并将其转换为本机数据结构。 (有关本机数据结构的示例,请参阅Pike , Python和Ruby实现。)
+[S-Expressions](https://en.wikipedia.org/wiki/S-Expression "wp: S-Expression") are one convenient way to parse and store data.
+
+# --instructions--
+
+Write a simple reader/parser for S-Expressions that handles quoted and unquoted strings, integers and floats.
+
+The function should read a single but nested S-Expression from a string and return it as a (nested) array.
+
+Newlines and other whitespace may be ignored unless contained within a quoted string.
+
+"`()`" inside quoted strings are not interpreted, but treated as part of the string.
+
+Handling escaped quotes inside a string is optional; thus "`(foo"bar)`" may be treated as a string "`foo"bar`", or as an error.
+
+For this, the reader need not recognize "\\" for escaping, but should, in addition, recognize numbers if the language has appropriate data types.
+
+Note that with the exception of "`()"`" ("\\" if escaping is supported) and whitespace there are no special characters. Anything else is allowed without quotes.
+
+The reader should be able to read the following input
+
+((data "quoted data" 123 4.5)
+(data (!@# (4.5) "(more" "data)")))
+
+
+and turn it into a native data structure. (See the [Pike](https://rosettacode.org/wiki/S-Expressions#Pike "\#Pike"), [Python](https://rosettacode.org/wiki/S-Expressions#Python "\#Python") and [Ruby](https://rosettacode.org/wiki/S-Expressions#Ruby "\#Ruby") implementations for examples of native data structures.)
# --hints--
-`parseSexpr`是一个函数。
+`parseSexpr` should be a function.
```js
assert(typeof parseSexpr === 'function');
```
-`parseSexpr("(data1 data2 data3)")`应返回[“data1”,“data2”,“data3”]“)
+`parseSexpr('(data1 data2 data3)')` should return `['data1', 'data2', 'data3']`
```js
assert.deepEqual(parseSexpr(simpleSExpr), simpleSolution);
```
-`parseSexpr("(data1 data2 data3)")`应该返回一个包含3个元素的数组“)'
+`parseSexpr('(data1 data2 data3)')` should return an array with 3 elements.
```js
assert.deepEqual(parseSexpr(basicSExpr), basicSolution);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sailors-coconuts-and-a-monkey-problem.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sailors-coconuts-and-a-monkey-problem.md
index cf3a4fe252e..ec8a0c6e2db 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sailors-coconuts-and-a-monkey-problem.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sailors-coconuts-and-a-monkey-problem.md
@@ -1,36 +1,45 @@
---
id: 59da22823d04c95919d46269
-title: 水手,椰子和猴子问题
+title: 'Sailors, coconuts and a monkey problem'
challengeType: 5
-videoUrl: ''
+forumTopicId: 302304
dashedName: sailors-coconuts-and-a-monkey-problem
---
# --description--
-五名水手在岛上遭遇海难,并在白天收集了一大堆椰子。
那天晚上,第一个水手醒来并决定早点拿走他的第一份,所以试图将一堆椰子平分成五堆,但发现剩下一个椰子,所以他把它扔到一只猴子然后隐藏“他的”五个同样大小的椰子堆中的一个,并将其他四个桩推到一起,再次形成一堆可见的椰子并上床睡觉。
长话短说,每个水手轮流在夜间起床,并执行将椰子堆分成五个的相同动作,发现剩下一个椰子并将剩下的椰子留给猴子。
在早上(在夜间五个水手的暗中和分开行动之后),剩下的椰子被分成五个相等的堆,每个水手,然后发现一堆椰子在水手之间平分没有余数。 (早上猴子没什么。)
任务:
Create a function that returns the the minimum possible size of the initial pile of coconuts collected during the day for N sailors.
注意:
Of course the tale is told in a world where the collection of any amount of coconuts in a day and multiple divisions of the pile, etc can occur in time fitting the story line, so as not to affect the mathematics.
CF卡:
猴子和椰子 - Numberphile (视频)分析解决方案。
<a href="http://oeis.org/A002021" title="link: http://oeis.org/A002021">A002021 Pile of coconuts problem</a> The On-Line Encyclopedia of Integer Sequences. (Although some of its references may use the alternate form of the tale).
+Five sailors are shipwrecked on an island and collect a large pile of coconuts during the day. That night the first sailor wakes up and decides to take his first share early so tries to divide the pile of coconuts equally into five piles but finds that there is one coconut left over, so he tosses it to a monkey and then hides "his" one of the five equally sized piles of coconuts and pushes the other four piles together to form a single visible pile of coconuts again and goes to bed. To cut a long story short, each of the sailors in turn gets up once during the night and performs the same actions of dividing the coconut pile into five, finding that one coconut is left over and giving that single remainder coconut to the monkey. In the morning (after the surreptitious and separate action of each of the five sailors during the night), the remaining coconuts are divided into five equal piles for each of the sailors, whereupon it is found that the pile of coconuts divides equally amongst the sailors with no remainder. (Nothing for the monkey in the morning.)
+
+# --instructions--
+
+Create a function that returns the minimum possible size of the initial pile of coconuts collected during the day for `N` sailors. **Note:** Of course the tale is told in a world where the collection of any amount of coconuts in a day and multiple divisions of the pile, etc. can occur in time fitting the story line, so as not to affect the mathematics. **C.f:**
+
+
# --hints--
-`splitCoconuts`是一个函数。
+`splitCoconuts` should be a function.
```js
assert(typeof splitCoconuts === 'function');
```
-`splitCoconuts(5)`应该返回3121。
+`splitCoconuts(5)` should return 3121.
```js
assert(splitCoconuts(5) === 3121);
```
-`splitCoconuts(6)`应返回233275。
+`splitCoconuts(6)` should return 233275.
```js
assert(splitCoconuts(6) === 233275);
```
-`splitCoconuts(7)`应该返回823537。
+`splitCoconuts(7)` should return 823537.
```js
assert(splitCoconuts(7) === 823537);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sedols.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sedols.md
index ab5b40bb42e..9d5ce33e9d3 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sedols.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sedols.md
@@ -2,51 +2,57 @@
id: 59d9c6bc214c613ba73ff012
title: SEDOLs
challengeType: 5
-videoUrl: ''
+forumTopicId: 302305
dashedName: sedols
---
# --description--
-任务:
+For each number list of 6-digit [SEDOL](https://en.wikipedia.org/wiki/SEDOL "wp: SEDOL")s, calculate and append the checksum digit. That is, given the input string on the left, your function should return the corresponding string on the right:
-对于6位[SEDOL](https://en.wikipedia.org/wiki/SEDOL "wp:SEDOL")的每个数字列表,计算并附加校验和数字。
+
+710889 => 7108899
+B0YBKJ => B0YBKJ7
+406566 => 4065663
+B0YBLH => B0YBLH2
+228276 => 2282765
+B0YBKL => B0YBKL9
+557910 => 5579107
+B0YBKR => B0YBKR5
+585284 => 5852842
+B0YBKT => B0YBKT7
+B00030 => B000300
+
-也就是说,给定左侧的输入字符串,您的函数应返回右侧的相应字符串:
-
-```
- 710889 => 7108899 B0YBKJ => B0YBKJ7 406566 => 4065663 B0YBLH => B0YBLH2 228276 => 2282765 B0YBKL => B0YBKL9 557910 => 5579107 B0YBKR => B0YBKR5 585284 => 5852842 B0YBKT => B0YBKT7 B00030 => B000300
-```
-
-还要检查每个输入是否正确形成,尤其是对于SEDOL字符串中允许的有效字符。您的函数应在无效输入时返回`null` 。
+Check that each input is correctly formed, especially with respect to valid characters allowed in a SEDOL string. Your function should return `null` on an invalid input.
# --hints--
-`sedol`是一个功能。
+`sedol` should be a function.
```js
assert(typeof sedol === 'function');
```
-`sedol('a')`应该返回null。
+`sedol('a')` should return null.
```js
assert(sedol('a') === null);
```
-`sedol('710889')`应返回'7108899'。
+`sedol('710889')` should return '7108899'.
```js
assert(sedol('710889') === '7108899');
```
-`sedol('BOATER')`应该返回null。
+`sedol('BOATER')` should return null.
```js
assert(sedol('BOATER') === null);
```
-`sedol('228276')`应该返回'228276'。
+`sedol('228276')` should return '2282765'.
```js
assert(sedol('228276') === '2282765');
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/self-describing-numbers.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/self-describing-numbers.md
index 5ff2f5c9923..df2a88508fb 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/self-describing-numbers.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/self-describing-numbers.md
@@ -89,7 +89,7 @@ function isSelfDescribing(n) {
if (digits.length != count.length) {
return false;
}
-
+
for (let i=0; i< digits.length; i++){
if (digits[i] !== count[i]) {
return false;
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/self-referential-sequence.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/self-referential-sequence.md
index 0cc45a42fff..11beda8ba0b 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/self-referential-sequence.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/self-referential-sequence.md
@@ -8,7 +8,7 @@ dashedName: self-referential-sequence
# --description--
-There are several ways to generate a self-referential sequence. One very common one (the [Look-and-say sequence]()) is to start with a positive integer, then generate the next term by concatenating enumerated groups of adjacent alike digits:
+There are several ways to generate a self-referential sequence. One very common one (the [Look-and-say sequence](https://rosettacode.org/wiki/Look-and-say sequence)) is to start with a positive integer, then generate the next term by concatenating enumerated groups of adjacent alike digits:
0, 10, 1110, 3110, 132110, 1113122110, 311311222110 ...
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md
index 86aeeda4c83..f4c1b63f681 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md
@@ -8,7 +8,7 @@ dashedName: sorting-algorithmscocktail-sort
# --description--
-The cocktail shaker sort is an improvement on the [Bubble Sort](). The improvement is basically that values "bubble" both directions through the array, because on each iteration the cocktail shaker sort bubble sorts once forwards and once backwards. Pseudocode for the algorithm (from [wikipedia]()):
+The cocktail shaker sort is an improvement on the [Bubble Sort](https://rosettacode.org/wiki/Bubble Sort). The improvement is basically that values "bubble" both directions through the array, because on each iteration the cocktail shaker sort bubble sorts once forwards and once backwards. Pseudocode for the algorithm (from [wikipedia](https://en.wikipedia.org/wiki/Cocktail sort)):
function cocktailSort( A : list of sortable items )
do
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-comb-sort.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-comb-sort.md
index 2b31fb98db8..472ce20af5a 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-comb-sort.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-comb-sort.md
@@ -10,9 +10,9 @@ dashedName: sorting-algorithmscomb-sort
Implement a *comb sort*.
-The **Comb Sort** is a variant of the [Bubble Sort]().
+The **Comb Sort** is a variant of the [Bubble Sort](https://rosettacode.org/wiki/Bubble Sort).
-Like the [Shell sort](), the Comb Sort increases the gap used in comparisons and exchanges.
+Like the [Shell sort](https://rosettacode.org/wiki/Shell sort), the Comb Sort increases the gap used in comparisons and exchanges.
Dividing the gap by $(1-e^{-\\varphi})^{-1} \\approx 1.247330950103979$ works best, but 1.3 may be more practical.
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md
index 4aebdd0fe85..e3162404d9b 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md
@@ -8,7 +8,7 @@ dashedName: sorting-algorithmsgnome-sort
# --description--
-Gnome sort is a sorting algorithm which is similar to [Insertion sort](), except that moving an element to its proper place is accomplished by a series of swaps, as in [Bubble Sort]().
+Gnome sort is a sorting algorithm which is similar to [Insertion sort](https://rosettacode.org/wiki/Insertion sort), except that moving an element to its proper place is accomplished by a series of swaps, as in [Bubble Sort](https://rosettacode.org/wiki/Bubble Sort).
The pseudocode for the algorithm is:
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md
index 1a4a28928c8..f107df7b79a 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md
@@ -8,7 +8,7 @@ dashedName: sorting-algorithmspancake-sort
# --description--
-Write a function to sort an array of integers (of any convenient size) into ascending order using [Pancake sorting](). The function should return the sorted array.
+Write a function to sort an array of integers (of any convenient size) into ascending order using [Pancake sorting](https://en.wikipedia.org/wiki/Pancake sorting). The function should return the sorted array.
In short, instead of individual elements being sorted, the only operation allowed is to "flip" one end of the list, like so:
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md
index 3d69051f4d9..09403447320 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md
@@ -8,7 +8,7 @@ dashedName: sorting-algorithmsshell-sort
# --description--
-Write a function to sort an array of elements using the [Shell sort]() algorithm, a diminishing increment sort. The function should return the sorted array.
+Write a function to sort an array of elements using the [Shell sort](https://en.wikipedia.org/wiki/Shell sort) algorithm, a diminishing increment sort. The function should return the sorted array.
The Shell sort (also known as Shellsort or Shell's method) is named after its inventor, Donald Shell, who published the algorithm in 1959.
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md
index 04dee734ead..ec108886c1f 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md
@@ -8,7 +8,7 @@ dashedName: sorting-algorithmsstooge-sort
# --description--
-Write a function to perform [Stooge Sort]() on an array of integers. The function should return a sorted array.
+Write a function to perform [Stooge Sort](https://en.wikipedia.org/wiki/Stooge sort) on an array of integers. The function should return a sorted array.
The Stooge Sort algorithm is as follows:
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md
index a603bbab952..d8408782db5 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md
@@ -8,7 +8,7 @@ dashedName: sorting-algorithmsstrand-sort
# --description--
-Write a function to sort an array using the [Strand sort](). The function should return the sorted array.
+Write a function to sort an array using the [Strand sort](https://en.wikipedia.org/wiki/Strand sort). The function should return the sorted array.
This is a way of sorting numbers by extracting shorter sequences of already sorted numbers from an unsorted list.
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/stern-brocot-sequence.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/stern-brocot-sequence.md
index e8acb84c3c9..55580822989 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/stern-brocot-sequence.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/stern-brocot-sequence.md
@@ -8,7 +8,7 @@ dashedName: stern-brocot-sequence
# --description--
-For this task, the Stern-Brocot sequence is to be generated by an algorithm similar to that employed in generating the [Fibonacci sequence]().
+For this task, the Stern-Brocot sequence is to be generated by an algorithm similar to that employed in generating the [Fibonacci sequence](https://rosettacode.org/wiki/Fibonacci sequence).
- The first and second members of the sequence are both 1:
@@ -36,7 +36,7 @@ For this task, the Stern-Brocot sequence is to be generated by an algorithm simi
# --instructions--
-Create a function that returns the $ n^{th} $ member of the sequence using the method outlined above.
+Create a function that returns the position in the Stern-Brocot sequence at which $ n $ is first encountered, where the sequence is generated with the method outlined above. Note that this sequence uses 1 based indexing.
# --hints--
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sum-of-a-series.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sum-of-a-series.md
index 69fdff56995..35fee317742 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sum-of-a-series.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sum-of-a-series.md
@@ -8,7 +8,7 @@ dashedName: sum-of-a-series
# --description--
-Compute the **n**th term of a [series](), i.e. the sum of the **n** first terms of the corresponding [sequence](https://en.wikipedia.org/wiki/sequence). Informally this value, or its limit when **n** tends to infinity, is also called the *sum of the series*, thus the title of this task. For this task, use: $S*n = \\sum*{k=1}^n \\frac{1}{k^2}$ and compute $S\_{1000}$ This approximates the [zeta function]() for S=2, whose exact value $\\zeta(2) = {\\pi^2\\over 6}$ is the solution of the [Basel problem]().
+Compute the **n**th term of a [series](https://en.wikipedia.org/wiki/Series (mathematics)), i.e. the sum of the **n** first terms of the corresponding [sequence](https://en.wikipedia.org/wiki/sequence). Informally this value, or its limit when **n** tends to infinity, is also called the *sum of the series*, thus the title of this task. For this task, use: $S*n = \\sum*{k=1}^n \\frac{1}{k^2}$ and compute $S\_{1000}$ This approximates the [zeta function](https://en.wikipedia.org/wiki/Riemann zeta function) for S=2, whose exact value $\\zeta(2) = {\\pi^2\\over 6}$ is the solution of the [Basel problem](https://en.wikipedia.org/wiki/Basel problem).
# --instructions--
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sutherland-hodgman-polygon-clipping.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sutherland-hodgman-polygon-clipping.md
index c3b671bf5a5..50fe64ed639 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sutherland-hodgman-polygon-clipping.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/sutherland-hodgman-polygon-clipping.md
@@ -8,7 +8,7 @@ dashedName: sutherland-hodgman-polygon-clipping
# --description--
-The [Sutherland-Hodgman clipping algorithm]() finds the polygon that is the intersection between an arbitrary polygon (the "subject polygon") and a convex polygon (the "clip polygon"). It is used in computer graphics (especially 2D graphics) to reduce the complexity of a scene being displayed by eliminating parts of a polygon that do not need to be displayed. Take the closed polygon defined by the points:
+The [Sutherland-Hodgman clipping algorithm](https://en.wikipedia.org/wiki/Sutherland-Hodgman clipping algorithm) finds the polygon that is the intersection between an arbitrary polygon (the "subject polygon") and a convex polygon (the "clip polygon"). It is used in computer graphics (especially 2D graphics) to reduce the complexity of a scene being displayed by eliminating parts of a polygon that do not need to be displayed. Take the closed polygon defined by the points:
[(50, 150), (200, 50), (350, 150), (350, 300), (250, 300), (200, 250), (150, 350), (100, 250), (100, 200)]
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/symmetric-difference.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/symmetric-difference.md
index 422cb77cc23..7009bce4617 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/symmetric-difference.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/symmetric-difference.md
@@ -8,7 +8,7 @@ dashedName: symmetric-difference
# --description--
-Given two [set](https://rosettacode.org/wiki/set)s *A* and *B*, compute $(A \\setminus B) \\cup (B \\setminus A).$ That is, enumerate the items that are in *A* or *B* but not both. This set is called the [symmetric difference]() of *A* and *B*. In other words: $(A \\cup B) \\setminus (A \\cap B)$ (the set of items that are in at least one of *A* or *B* minus the set of items that are in both *A* and *B*).
+Given two [set](https://rosettacode.org/wiki/set)s *A* and *B*, compute $(A \\setminus B) \\cup (B \\setminus A).$ That is, enumerate the items that are in *A* or *B* but not both. This set is called the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric difference) of *A* and *B*. In other words: $(A \\cup B) \\setminus (A \\cap B)$ (the set of items that are in at least one of *A* or *B* minus the set of items that are in both *A* and *B*).
# --instructions--
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/taxicab-numbers.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/taxicab-numbers.md
index 6aabd0e0aca..895b46ef050 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/taxicab-numbers.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/taxicab-numbers.md
@@ -1,48 +1,74 @@
---
id: 594ecc0d9a8cf816e3340187
-title: 出租车号码
+title: Taxicab numbers
challengeType: 5
-videoUrl: ''
+forumTopicId: 302337
dashedName: taxicab-numbers
---
# --description--
-[出租车编号]( "wp:Hardy-Ramanujan号码") (此处使用的定义)是一个正整数,可以用多种方式表示为两个正立方体的总和。第一个出租车编号是1729,即:1 3 + 12 3和9 3 + 10 3 。出租车号码也被称为:\*出租车号码\*出租车号码\*出租车号码\* Hardy-Ramanujan号码任务:编写一个返回最低N个出租车号码的函数。对于每个出租车编号,显示数字以及它的构成立方体。另请参阅:在线整数序列百科全书上的\[`http://oeis.org/A001235` A001235出租车编号]。 MathWorld上的[Hardy-Ramanujan数字](http://mathworld.wolfram.com/Hardy-RamanujanNumber.html) 。 MathWorld上的[出租车编号](http://mathworld.wolfram.com/TaxicabNumber.html) 。维基百科上的[出租车号码](https://en.wikipedia.org/wiki/Taxicab_number) 。
+A [taxicab number](https://en.wikipedia.org/wiki/Hardy–Ramanujan number "wp: Hardy–Ramanujan number") (the definition that is being used here) is a positive integer that can be expressed as the sum of two positive cubes in more than one way.
+
+The first taxicab number is `1729`, which is:
+
+13 + 123 and
+
+93 + 103.
+
+Taxicab numbers are also known as:
+
+
+ - taxi numbers
+ - taxi-cab numbers
+ - taxi cab numbers
+ - Hardy-Ramanujan numbers
+
+
+# --instructions--
+
+Write a function that returns the lowest `n` taxicab numbers. For each of the taxicab numbers, show the number as well as its constituent cubes.
+
+**See also:**
+
+
# --hints--
-`taxicabNumbers`是一个功能。
+`taxicabNumbers` should be a function.
```js
assert(typeof taxicabNumbers === 'function');
```
-`taxicabNumbers`应该返回一个数组。
+`taxicabNumbers` should return an array.
```js
assert(typeof taxicabNumbers(2) === 'object');
```
-`taxicabNumbers`应返回一组数字。
+`taxicabNumbers` should return an array of numbers.
```js
assert(typeof taxicabNumbers(100)[0] === 'number');
```
-`taxicabNumbers(4)`必须返回[1729,4104,13832,20683]。
+`taxicabNumbers(4)` should return [1729, 4104, 13832, 20683].
```js
assert.deepEqual(taxicabNumbers(4), res4);
```
-taxicabNumbers(25)应该返回[1729,4104,13832,20683,32832,39312,40033,46683,64232,65728,110656,110808,134379,149389,165464,171288,195841,216027,216125,262656,314696,320264 ,327763,373464,402597]
+`taxicabNumbers(25)` should return [1729, 4104, 13832, 20683, 32832, 39312, 40033, 46683, 64232, 65728, 110656, 110808, 134379, 149389, 165464, 171288, 195841, 216027, 216125, 262656, 314496, 320264, 327763, 373464, 402597]
```js
assert.deepEqual(taxicabNumbers(25), res25);
```
-taxicabNumbers(39)由20 - 29得到的数字应为[314496,320264,327763,373464,402597,439101,443889,513000,513856]。
+`taxicabNumbers(39)` resulting numbers from 20 - 29 should be [314496,320264,327763,373464,402597,439101,443889,513000,513856].
```js
assert.deepEqual(taxicabNumbers(39).slice(20, 29), res39From20To29);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/tokenize-a-string-with-escaping.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/tokenize-a-string-with-escaping.md
index d4c4f9f2724..24a65a163e8 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/tokenize-a-string-with-escaping.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/tokenize-a-string-with-escaping.md
@@ -1,37 +1,72 @@
---
id: 594faaab4e2a8626833e9c3d
-title: 使用转义标记字符串
+title: Tokenize a string with escaping
challengeType: 5
-videoUrl: ''
+forumTopicId: 302338
dashedName: tokenize-a-string-with-escaping
---
# --description--
-编写一个函数或程序,可以在分隔符的每个非转义事件中拆分字符串。
它应该接受三个输入参数:
字符串 分隔符字符 转义字符 它应该输出一个字符串列表。
拆分规则:
由分隔符分隔的字段将成为输出列表的元素。应保留空字段,即使在开始和结束时也是如此。 转义规则:
“Escaped”意味着出现一个尚未自行转义的转义字符。当转义字符位于没有特殊含义的字符之前时,它仍然被视为转义符(但不会做任何特殊操作)。用于转义某些内容的每次出现的转义字符都不应成为输出的一部分。 证明您的函数满足以下测试用例:给定字符串
一个^ | UNO || 3 ^^^^ |四^^^ | ^夸|
和使用 |
作为分隔符和 ^
作为转义字符,您的函数应输出以下数组: ['one | uno',“,'three ^^','four ^ | quatro',”]
-
+Write a function or program that can split a string at each non-escaped occurrence of a separator character.
+
+It should accept three input parameters:
+
+
+ - The string
+ - The separator character
+ - The escape character
+
+
+It should output a list of strings.
+
+Rules for splitting:
+
+
+ - The fields that were separated by the separators, become the elements of the output list.
+ - Empty fields should be preserved, even at the start and end.
+
+
+Rules for escaping:
+
+
+ - "Escaped" means preceded by an occurrence of the escape character that is not already escaped itself.
+ - When the escape character precedes a character that has no special meaning, it still counts as an escape (but does not do anything special).
+ - Each occurrences of the escape character that was used to escape something, should not become part of the output.
+
+
+Demonstrate that your function satisfies the following test-case:
+
+Given the string
+
+one^|uno||three^^^^|four^^^|^cuatro|
+
+and using `|` as a separator and `^` as escape character, your function should output the following array:
+
+ ['one|uno', '', 'three^^', 'four^|cuatro', '']
+
# --hints--
-`tokenize`是一个函数。
+`tokenize` should be a function.
```js
assert(typeof tokenize === 'function');
```
-`tokenize`应该返回一个数组。
+`tokenize` should return an array.
```js
assert(typeof tokenize('a', 'b', 'c') === 'object');
```
-`tokenize("one^|uno||three^^^^|four^^^|^cuatro|", "|", "^")`应返回[“one | uno”,“”,“three ^^” ,“四个^ | cuatro”,“”]“)
+`tokenize('one^|uno||three^^^^|four^^^|^cuatro|', '|', '^')` should return `['one|uno', '', 'three^^', 'four^|cuatro', '']`
```js
assert.deepEqual(tokenize(testStr1, '|', '^'), res1);
```
-`tokenize("a@&bcd&ef&&@@hi", "&", "@")`应返回`["a&bcd", "ef", "", "@hi"]`
+`tokenize('a@&bcd&ef&&@@hi', '&', '@')` should return `['a&bcd', 'ef', '', '@hi']`
```js
assert.deepEqual(tokenize(testStr2, '&', '@'), res2);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/top-rank-per-group.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/top-rank-per-group.md
index 3f1b90ac5e8..c9405c8f3f3 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/top-rank-per-group.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/top-rank-per-group.md
@@ -1,85 +1,94 @@
---
id: 595011cba5a81735713873bd
-title: 每组排名最高
+title: Top rank per group
challengeType: 5
-videoUrl: ''
+forumTopicId: 302339
dashedName: top-rank-per-group
---
# --description--
-任务:
+Find the top `n` ranked data in each group, where `n` is provided as a parameter. Name of the rank and the group are also provided as parameter.
-在每个组中查找排名前N位的数据,其中N作为参数提供。等级和组的名称也作为参数提供。
+Given the following data:
-鉴于以下数据:
+[
+ { name: 'Tyler Bennett', id: 'E10297', salary: 32000, dept: 'D101' },
+ { name: 'John Rappl', id: 'E21437', salary: 47000, dept: 'D050' },
+ { name: 'George Woltman', id: 'E00127', salary: 53500, dept: 'D101' },
+ { name: 'Adam Smith', id: 'E63535', salary: 18000, dept: 'D202' },
+ { name: 'Claire Buckman', id: 'E39876', salary: 27800, dept: 'D202' },
+ { name: 'David McClellan', id: 'E04242', salary: 41500, dept: 'D101' },
+ { name: 'Rich Holcomb', id: 'E01234', salary: 49500, dept: 'D202' },
+ { name: 'Nathan Adams', id: 'E41298', salary: 21900, dept: 'D050' },
+ { name: 'Richard Potter', id: 'E43128', salary: 15900, dept: 'D101' },
+ { name: 'David Motsinger', id: 'E27002', salary: 19250, dept: 'D202' },
+ { name: 'Tim Sampair', id: 'E03033', salary: 27000, dept: 'D101' },
+ { name: 'Kim Arlich', id: 'E10001', salary: 57000, dept: 'D190' },
+ { name: 'Timothy Grove', id: 'E16398', salary: 29900, dept: 'D190' }
+];
+
-```
- [
-{姓名:'Tyler Bennett',id:'E10297',薪水:32000,部门:'D101'},
-{姓名:'John Rappl',id:'E21437',薪水:47000,部门:'D050'},
-{姓名:'George Woltman',id:'E00127',薪水:53500,部门:'D101'},
-{name:'Adam Smith',id:'E63535',薪水:18000,部门:'D202'},
-{姓名:'Claire Buckman',id:'E39876',薪水:27800,部门:'D202'},
-{姓名:'David McClellan',id:'E04242',薪水:41500,部门:'D101'},
-{name:'Rich Holcomb',id:'E01234',薪水:49500,dept:'D202'},
-{姓名:'Nathan Adams',id:'E41298',薪水:21900,部门:'D050'},
-{姓名:'Richard Potter',id:'E43128',薪水:15900,部门:'D101'},
-{姓名:'David Motsinger',id:'E27002',薪水:19250,dept:'D202'},
-{姓名:'Tim Sampair',id:'E03033',薪水:27000,部门:'D101'},
-{姓名:'Kim Arlich',id:'E10001',薪水:57000,部门:'D190'},
-{name:'Timothy Grove',id:'E16398',薪水:29900,部门:'D190'}
-]。
-```
+one could rank top 10 employees in each department by calling
-
通过调用topRankPerGroup(10, data, 'dept', 'salary')可以对每个部门的前10名员工进行排名。给出以下数据: [
- {name:'Friday 13th',类型:'恐怖',评分:9.9},
- {姓名:“榆树街上的梦魇”,类型:'恐怖',等级:5.7},
- {name:'Titanic',类型:'drama',评分:7.3},
- {name:'Maze Runner',类型:'scifi',评级:7.1},
- {name:'Blade runner',类型:'scifi',评分:8.9}
-]。
-通过调用topRankPerGroup(1, data, 'genre', 'rating')可以在每个类型中对排名最高的电影进行排名
+`topRankPerGroup(10, data, 'dept', 'salary')`
+
+Given the following data:
+
+[
+ { name: 'Friday 13th', genre: 'horror', rating: 9.9 },
+ { name: "Nightmare on Elm's Street", genre: 'horror', rating: 5.7 },
+ { name: 'Titanic', genre: 'drama', rating: 7.3 },
+ { name: 'Maze Runner', genre: 'scifi', rating: 7.1 },
+ { name: 'Blade runner', genre: 'scifi', rating: 8.9 }
+];
+
+
+one could rank the top-rated movie in each genre by calling
+
+`topRankPerGroup(1, data, 'genre', 'rating')`
+
+The function should return an array with an array for each group containing the top `n` objects.
# --hints--
-`topRankPerGroup`是一个函数。
+`topRankPerGroup` should be a function.
```js
assert(typeof topRankPerGroup === 'function');
```
-`topRankPerGroup`在负n值上返回undefined。
+`topRankPerGroup` should return undefined on negative n values.
```js
assert(typeof topRankPerGroup(-1, []) === 'undefined');
```
-第一部门必须是D050
+First department should be D050
```js
assert.equal(res1[0][0].dept, 'D050');
```
-第一部门必须是D050
+First department should be D050
```js
assert.equal(res1[0][1].salary, 21900);
```
-最后一个部门必须是D202
+The last department should be D202
```js
assert.equal(res1[3][3].dept, 'D202');
```
-`topRankPerGroup(1, ...)`必须仅返回每组的排名最高的结果。
+`topRankPerGroup(1, ...)` should return only top ranking result per group.
```js
assert.equal(res2[2].length, 1);
```
-`topRankPerGroup(1, ...)`必须仅返回每组的排名最高的结果。
+`topRankPerGroup(1, ...)` should return only top ranking result per group.
```js
assert.equal(res3[2][1].name, 'Maze Runner');
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/topological-sort.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/topological-sort.md
index 608c67c7212..1f091c8bf9f 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/topological-sort.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/topological-sort.md
@@ -1,57 +1,81 @@
---
id: 594fa2746886f41f7d8bf225
-title: 拓扑排序
+title: Topological sort
challengeType: 5
-videoUrl: ''
+forumTopicId: 302340
dashedName: topological-sort
---
# --description--
-给定项目之间的映射以及它们所依赖的项目, 拓扑排序会对项目进行排序 ,以使项目不在其所依赖的项目之前。
用VHDL语言编译库有一个限制,即必须在它依赖的库之后编译库。
任务: 编写一个函数,该函数将从其依赖项返回VHDL库的有效编译顺序。
假设库名称是单个单词。仅作为家属提及的项目没有自己的家属,但必须给出他们的编制顺序。任何自我依赖都应该被忽略。应忽略任何不可订购的依赖项。 使用以下数据作为示例:
图书馆图书馆依赖
-======= ====================
-des_system_lib std synopsys std_cell_lib des_system_lib dw02 dw01 ramlib ieee
-dw01 ieee dw01 dware gtech
-dw02 ieee dw02 dware
-dw03 std synopsys dware dw03 dw02 dw01 ieee gtech
-dw04 dw04 ieee dw01 dware gtech
-dw05 dw05 ieee dware
-dw06 dw06 ieee dware
-dw07 ieee dware
-dware ieee dware
-gtech ieee gtech
-ramlib std ieee
-std_cell_lib ieee std_cell_lib
-新思
-
注意:如果将dw04添加到dw01的依赖项列表中,则上述数据将无法订购。
CF卡: <a href="http://rosettacode.org/wiki/Topological sort/Extracted top item" title="Topological sort/Extracted top item">Topological sort/Extracted top item</a>.
拓扑排序有两种流行的算法:
Kahn的1962拓扑排序和深度优先搜索: 拓扑排序
Jason Sachs: “十个小算法,第四部分:拓扑排序” 。
+Given a mapping between items, and items they depend on, a [topological sort](https://en.wikipedia.org/wiki/Topological sorting "wp: Topological sorting") orders items so that no item precedes an item it depends upon. The compiling of a library in the [VHDL](https://en.wikipedia.org/wiki/VHDL "wp: VHDL") language has the constraint that a library must be compiled after any library it depends on.
+
+# --instructions--
+
+Write a function that will return a valid compile order of VHDL libraries from their dependencies.
+
+
+ - Assume library names are single words.
+ - Items mentioned as only dependents have no dependents of their own, but their order of compiling must be given.
+ - Any self dependencies should be ignored.
+ - Any un-orderable dependencies should be ignored.
+
+Use the following data as an example:
+
+LIBRARY LIBRARY DEPENDENCIES
+======= ====================
+des_system_lib std synopsys std_cell_lib des_system_lib dw02 dw01 ramlib ieee
+dw01 ieee dw01 dware gtech
+dw02 ieee dw02 dware
+dw03 std synopsys dware dw03 dw02 dw01 ieee gtech
+dw04 dw04 ieee dw01 dware gtech
+dw05 dw05 ieee dware
+dw06 dw06 ieee dware
+dw07 ieee dware
+dware ieee dware
+gtech ieee gtech
+ramlib std ieee
+std_cell_lib ieee std_cell_lib
+synopsys
+
+Note: the above data would be un-orderable if, for example, dw04 is added to the list of dependencies of dw01.
+C.f.:
+
+There are two popular algorithms for topological sorting:
+
# --hints--
-`topologicalSort`是一个函数。
+`topologicalSort` should be a function.
```js
assert(typeof topologicalSort === 'function');
```
-`topologicalSort`必须返回正确的库顺序..
+`topologicalSort` should return correct library order.
```js
assert.deepEqual(topologicalSort(libsSimple), ['bbb', 'aaa']);
```
-`topologicalSort`必须返回正确的库顺序..
+`topologicalSort` should return correct library order.
```js
assert.deepEqual(topologicalSort(libsVHDL), solutionVHDL);
```
-`topologicalSort`必须返回正确的库顺序..
+`topologicalSort` should return correct library order.
```js
assert.deepEqual(topologicalSort(libsCustom), solutionCustom);
```
-`topologicalSort`必须忽略不可共享的依赖项。
+`topologicalSort` should ignore unorderable dependencies.
```js
assert.deepEqual(topologicalSort(libsUnorderable), solutionUnorderable);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/towers-of-hanoi.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/towers-of-hanoi.md
index 337c49dc469..4de9c851ba4 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/towers-of-hanoi.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/towers-of-hanoi.md
@@ -1,46 +1,48 @@
---
id: 5951ed8945deab770972ae56
-title: 河内的塔
+title: Towers of Hanoi
challengeType: 5
-videoUrl: ''
+forumTopicId: 302341
dashedName: towers-of-hanoi
---
# --description--
-任务:
+Solve the [Towers of Hanoi](https://en.wikipedia.org/wiki/Towers_of_Hanoi "wp: Towers_of_Hanoi") problem.
-解决[河内塔](https://en.wikipedia.org/wiki/Towers_of_Hanoi "wp:Towers_of_Hanoi")问题。
+Your solution should accept the number of discs as the first parameters, and three string used to identify each of the three stacks of discs, for example `towerOfHanoi(4, 'A', 'B', 'C')`. The function should return an array of arrays containing the list of moves, source -> destination.
-您的解决方案应该接受光盘数量作为第一个参数,并使用三个字符串来识别三个光盘堆栈中的每一个,例如`towerOfHanoi(4, 'A', 'B', 'C')` 。该函数应该返回一个包含移动列表的数组数组,source - > destination。例如,数组`[['A', 'C'], ['B', 'A']]`表示第一个移动是将光盘从堆栈A移动到C,第二个移动是移动一个从堆栈B到A的光盘
+For example, the array `[['A', 'C'], ['B', 'A']]` indicates that the 1st move was to move a disc from stack A to C, and the 2nd move was to move a disc from stack B to A.
+
+
# --hints--
-`towerOfHanoi`是一个功能。
+`towerOfHanoi` should be a function.
```js
assert(typeof towerOfHanoi === 'function');
```
-`towerOfHanoi(3, ...)` 应该返回7招。
+`towerOfHanoi(3, ...)` should return 7 moves.
```js
assert(res3.length === 7);
```
-`towerOfHanoi(3, "A", "B", "C")`应返回\[[“A”,“B”],[“A”,“C”],[“B”,“C”],[ “A”, “B”],[ “C”, “A”],[ “C”, “B”],[ “A”, “B”]]“)。
+`towerOfHanoi(3, 'A', 'B', 'C')` should return `[['A','B'], ['A','C'], ['B','C'], ['A','B'], ['C','A'], ['C','B'], ['A','B']]`.
```js
assert.deepEqual(towerOfHanoi(3, 'A', 'B', 'C'), res3Moves);
```
-`towerOfHanoi(5, "X", "Y", "Z")`第10 `towerOfHanoi(5, "X", "Y", "Z")`应为Y - > X.
+`towerOfHanoi(5, "X", "Y", "Z")` 10th move should be Y -> X.
```js
assert.deepEqual(res5[9], ['Y', 'X']);
```
-`towerOfHanoi(7, "A", "B", "C")`前十个动作是\[[“A”,“B”],[“A”,“C”],[“B”,“C”][ “A”, “B”],[ “C”, “A”],[ “C”, “B”],[ “A”, “B”],[ “A”, “C”][ “B”, “C”],[ “B”, “A”]]“)。
+`towerOfHanoi(7, 'A', 'B', 'C')` first ten moves should be `[['A','B'], ['A','C'], ['B','C'], ['A','B'], ['C','A'], ['C','B'], ['A','B'], ['A','C'], ['B','C'], ['B','A']]`
```js
assert.deepEqual(towerOfHanoi(7, 'A', 'B', 'C').slice(0, 10), res7First10Moves);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/vector-cross-product.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/vector-cross-product.md
index 7ebf88873be..b7a9d18be14 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/vector-cross-product.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/vector-cross-product.md
@@ -1,38 +1,34 @@
---
id: 594810f028c0303b75339ad2
-title: 矢量交叉产品
+title: Vector cross product
challengeType: 5
-videoUrl: ''
+forumTopicId: 302342
dashedName: vector-cross-product
---
# --description--
-矢量被定义为具有三个维度,由三个数字的有序集合表示:(X,Y,Z)。
+A vector is defined as having three dimensions as being represented by an ordered collection of three numbers: (X, Y, Z).
-任务:
+# --instructions--
-```
- Write a function that takes two vectors (arrays) as input and computes their cross product.
-```
-
-您的函数应在无效输入(即不同长度的向量)上返回`null` 。
+Write a function that takes two vectors (arrays) as input and computes their cross product. Your function should return `null` on invalid inputs such as vectors of different lengths.
# --hints--
-dotProduct必须是一个函数
+dotProduct should be a function.
```js
assert.equal(typeof crossProduct, 'function');
```
-dotProduct()必须返回null
+dotProduct() should return null.
```js
assert.equal(crossProduct(), null);
```
-crossProduct([1,2,3],[4,5,6])必须返回[-3,6,-3]。
+crossProduct([1, 2, 3], [4, 5, 6]) should return [-3, 6, -3].
```js
assert.deepEqual(res12, exp12);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/vector-dot-product.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/vector-dot-product.md
index 6c48d5258ce..fb8ae242aed 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/vector-dot-product.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/vector-dot-product.md
@@ -1,60 +1,61 @@
---
id: 594810f028c0303b75339ad3
-title: 矢量点积
+title: Vector dot product
challengeType: 5
-videoUrl: ''
+forumTopicId: 302343
dashedName: vector-dot-product
---
# --description--
-矢量被定义为具有三个维度,由三个数字的有序集合表示:(X,Y,Z)。
任务:
Write a function that takes any numbers of vectors (arrays) as input and computes their dot product.
您的函数应在无效输入(即不同长度的向量)上返回null 。
+A vector can have one or more values represented by an ordered collection. Examples could be (x), (x, y), or (x, y, z).
+
+# --instructions--
+
+Write a function that takes two vectors (represented as one-dimensional arrays) as input and computes their dot product. Your function should return `null` on invalid inputs such as vectors of different lengths or passing anything other than two vectors.
# --hints--
-dotProduct必须是一个函数
+`dotProduct` should be a function.
```js
assert.equal(typeof dotProduct, 'function');
```
-dotProduct()必须返回null
+`dotProduct()` should return `null`.
```js
assert.equal(dotProduct(), null);
```
-dotProduct(\[[1],[1]])必须返回1。
+`dotProduct([1], [1])` should return `1`.
```js
assert.equal(dotProduct([1], [1]), 1);
```
-dotProduct(\[[1],[1,2]])必须返回null。
+`dotProduct([1], [1, 2])` should return `null`.
```js
assert.equal(dotProduct([1], [1, 2]), null);
```
-dotProduct([1,3,-5],[4,-2,-1])必须返回3。
+`dotProduct([1, 3, -5], [4, -2, -1])` should return `3`.
```js
assert.equal(dotProduct([1, 3, -5], [4, -2, -1]), 3);
```
-`dotProduct(...nVectors)`应该返回`dotProduct(...nVectors)`
+`dotProduct([3, 2, 1], [2, 4, 2], [5, 3, 1])` should return `null`.
```js
-assert.equal(
- dotProduct(
- [0, 1, 2, 3, 4],
- [0, 2, 4, 6, 8],
- [0, 3, 6, 9, 12],
- [0, 4, 8, 12, 16],
- [0, 5, 10, 15, 20]
- ),
- 156000
-);
+assert.equal(dotProduct([3, 2, 1], [2, 4, 2], [5, 3, 1]), null);
+```
+
+`dotProduct([ 0, 3, 6, 9, 12 ], [ 0, 4, 8, 12, 16 ])` should return `360`.
+
+```js
+assert.equal(dotProduct([ 0, 3, 6, 9, 12 ], [ 0, 4, 8, 12, 16 ]), 360);
```
# --seed--
@@ -71,29 +72,18 @@ function dotProduct(...vectors) {
```js
function dotProduct(...vectors) {
- if (!vectors || !vectors.length) {
- return null;
- }
- if (!vectors[0] || !vectors[0].length) {
+ if (!vectors || !vectors.length || vectors.length > 2 || vectors[0].length !== vectors[1].length) {
return null;
}
const vectorLen = vectors[0].length;
- const numVectors = vectors.length;
-
- // If all vectors not same length, return null
- for (let i = 0; i < numVectors; i++) {
- if (vectors[i].length !== vectorLen) {
- return null; // return undefined
- }
- }
let prod = 0;
let sum = 0;
let j = vectorLen;
- let i = numVectors;
+ let i = 2;
// Sum terms
while (j--) {
- i = numVectors;
+ i = 2;
prod = 1;
while (i--) {
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/word-wrap.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/word-wrap.md
index 3bc2a38c68c..344be87802e 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/word-wrap.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/word-wrap.md
@@ -1,56 +1,59 @@
---
id: 594810f028c0303b75339ad4
-title: 自动换行
+title: Word wrap
challengeType: 5
-videoUrl: ''
+forumTopicId: 302344
dashedName: word-wrap
---
# --description--
-即使在今天,使用比例字体和复杂布局,仍然存在需要在指定列处包装文本的情况。基本任务是以简单的方式包装一段文本。示例文字:
使用更复杂的算法(如Knuth和Plass TeX算法)包装文本。
-如果您的语言提供此功能,您可以获得额外的信用,
-但你“必须参考文档”表明该算法
-比简单的最小长度算法更好。
-
任务:
Write a function that can wrap this text to any number of characters.
例如,包装为80个字符的文本应如下所示:
使用更复杂的算法(如Knuth和Plass TeX)包装文本
-算法。如果您的语言提供此功能,您可以轻松获得额外的功劳
-必须参考文档,表明该算法更好
-而不是简单的最小长度算法。
+Even today, with proportional fonts and complex layouts, there are still cases where you need to wrap text at a specified column. The basic task is to wrap a paragraph of text in a simple way.
+
+# --instructions--
+
+Write a function that can wrap this text to any number of characters. As an example, the text wrapped to 80 characters should look like the following:
+
+
+Wrap text using a more sophisticated algorithm such as the Knuth and Plass TeX
+algorithm. If your language provides this, you get easy extra credit, but you
+must reference documentation indicating that the algorithm is something better
+than a simple minimum length algorithm.
# --hints--
-`wrap`是一个功能。
+wrap should be a function.
```js
assert.equal(typeof wrap, 'function');
```
-`wrap("abc", 10)`必须返回一个字符串。
+wrap should return a string.
```js
assert.equal(typeof wrap('abc', 10), 'string');
```
-wrap(80)必须返回4行。
+wrap(80) should return 4 lines.
```js
assert(wrapped80.split('\n').length === 4);
```
-你的`wrap`函数应该返回我们期望的文本
+Your `wrap` function should return our expected text.
```js
assert.equal(wrapped80.split('\n')[0], firstRow80);
```
-wrap(42)必须返回7行。
+wrap(42) should return 7 lines.
```js
assert(wrapped42.split('\n').length === 7);
```
-你的`wrap`函数应该返回我们期望的文本
+Your `wrap` function should return our expected text.
```js
assert.equal(wrapped42.split('\n')[0], firstRow42);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/y-combinator.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/y-combinator.md
index 865fc78e050..f76ab91e3c8 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/y-combinator.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/y-combinator.md
@@ -1,48 +1,56 @@
---
id: 594810f028c0303b75339ad5
-title: 和组合
+title: Y combinator
challengeType: 5
-videoUrl: ''
+forumTopicId: 302345
dashedName: y-combinator
---
# --description--
-在严格的函数编程和lambda演算中 ,函数(lambda表达式)没有状态,只允许引用封闭函数的参数。这排除了递归函数的通常定义,其中函数与变量的状态相关联,并且该变量的状态在函数体中使用。
Y组合器本身是一个无状态函数,当应用于另一个无状态函数时,它返回函数的递归版本。 Y组合器是这类函数中最简单的一种,称为定点组合器 。
任务: Define the stateless Y combinator function and use it to compute <a href="https://en.wikipedia.org/wiki/Factorial" title="wp: factorial">factorial</a>.
factorial(N)功能已经给你了。另见Jim Weirich:功能编程中的冒险 。
+In strict [functional programming](https://en.wikipedia.org/wiki/Functional programming "wp: functional programming") and the [lambda calculus](https://en.wikipedia.org/wiki/lambda calculus "wp: lambda calculus"), functions (lambda expressions) don't have state and are only allowed to refer to arguments of enclosing functions. This rules out the usual definition of a recursive function wherein a function is associated with the state of a variable and this variable's state is used in the body of the function. The [Y combinator](https://mvanier.livejournal.com/2897.html) is itself a stateless function that, when applied to another stateless function, returns a recursive version of the function. The Y combinator is the simplest of the class of such functions, called [fixed-point combinators](https://en.wikipedia.org/wiki/Fixed-point combinator "wp: fixed-point combinator").
+
+# --instructions--
+
+Define the stateless Y combinator function and use it to compute [factorial](https://en.wikipedia.org/wiki/Factorial "wp: factorial"). The `factorial(N)` function is already given to you. **See also:**
+
+
# --hints--
-Y必须返回一个函数
+Y should return a function.
```js
assert.equal(typeof Y((f) => (n) => n), 'function');
```
-factorial(1)必须返回1。
+factorial(1) should return 1.
```js
assert.equal(factorial(1), 1);
```
-factorial(2)必须返回2。
+factorial(2) should return 2.
```js
assert.equal(factorial(2), 2);
```
-factorial(3)必须返回6。
+factorial(3) should return 6.
```js
assert.equal(factorial(3), 6);
```
-factorial(4)必须返回24。
+factorial(4) should return 24.
```js
assert.equal(factorial(4), 24);
```
-factorial(10)必须返回3628800。
+factorial(10) should return 3628800.
```js
assert.equal(factorial(10), 3628800);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/zeckendorf-number-representation.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/zeckendorf-number-representation.md
index f69c43e5b67..35c7529bc40 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/zeckendorf-number-representation.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/zeckendorf-number-representation.md
@@ -1,24 +1,30 @@
---
id: 594810f028c0303b75339ad6
-title: 勾选村号码表示
+title: Zeckendorf number representation
challengeType: 5
-videoUrl: ''
+forumTopicId: 302346
dashedName: zeckendorf-number-representation
---
# --description--
-正如数字可以用位置表示法表示为十(十进制)或二(二进制)的幂的倍数之和;所有正整数都可以表示为Fibonacci系列的不同成员的一次或零次的总和。
回想一下,第一六个不同斐波那契数是: 1, 2, 3, 5, 8, 13 。十进制数11可以用位置表示法写成0*13 + 1*8 + 0*5 + 1*3 + 0*2 + 0*1或010100 ,其中列表示乘以序列的特定成员。前导零被丢弃,因此十进制11变为10100 。
10100不是从斐波那契数字中得到11的唯一方法,但是0*13 + 1*8 + 0*5 + 0*3 + 1*2 + 1*1或010011也代表十进制11。对于真正的Zeckendorf数字还有一个额外的限制,即“不能使用两个连续的Fibonacci数”,这导致了前一个独特的解决方案。
任务:编写一个函数,按顺序生成并返回前N个Zeckendorf数的数组。
+Just as numbers can be represented in a positional notation as sums of multiples of the powers of ten (decimal) or two (binary); all the positive integers can be represented as the sum of one or zero times the distinct members of the Fibonacci series. Recall that the first six distinct Fibonacci numbers are: `1, 2, 3, 5, 8, 13`.
+
+The decimal number eleven can be written as `0*13 + 1*8 + 0*5 + 1*3 + 0*2 + 0*1` or `010100` in positional notation where the columns represent multiplication by a particular member of the sequence. Leading zeroes are dropped so that 11 decimal becomes `10100`. 10100 is not the only way to make 11 from the Fibonacci numbers however `0*13 + 1*8 + 0*5 + 0*3 + 1*2 + 1*1` or 010011 would also represent decimal 11. For a true Zeckendorf number there is the added restriction that *no two consecutive Fibonacci numbers can be used* which leads to the former unique solution.
+
+# --instructions--
+
+Write a function that generates and returns an array of the first `n` Zeckendorf numbers in order.
# --hints--
-zeckendorf必须是功能
+zeckendorf should be function.
```js
assert.equal(typeof zeckendorf, 'function');
```
-你的`zeckendorf`函数应该返回正确的答案
+Your `zeckendorf` function should return the correct answer.
```js
assert.deepEqual(answer, solution20);
diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md
index adae08293ac..bad53c8710a 100644
--- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md
+++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.md
@@ -1,6 +1,6 @@
---
id: 594810f028c0303b75339ad7
-title: Zhang-Suen 细化算法
+title: Zhang-Suen thinning algorithm
challengeType: 5
forumTopicId: 302347
dashedName: zhang-suen-thinning-algorithm
@@ -8,7 +8,7 @@ dashedName: zhang-suen-thinning-algorithm
# --description--
-这是一个黑白图像(二值图像)的细化算法。 例如,输入图像如下:
+This is an algorithm used to thin a black and white i.e. one bit per pixel images. For example, with an input image of:
@@ -32,7 +32,7 @@ dashedName: zhang-suen-thinning-algorithm
######## ####### ###### ############# ######
-细化后的输出图像为:
+It produces the thinned output:
@@ -53,9 +53,9 @@ dashedName: zhang-suen-thinning-algorithm
-算法
+Algorithm
-假设黑像素点为 1,白像素点为 0;则输入图像可以用一个 N \* M 的矩阵(或数组)来表示,其中,矩阵中的元素只能为 0 或 1。这个算法对所有黑像素点 P1 进行操作。每个点 P1 都可以有 8 个相邻的点,分别是:
+Assume black pixels are one and white pixels zero, and that the input image is a rectangular N by M array of ones and zeroes. The algorithm operates on all black pixels P1 that can have eight neighbours. The neighbours are, in order, arranged as: