Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate algorithms #10

Merged
merged 24 commits into from
Aug 7, 2018
Merged

Conversation

BigFaceMaster
Copy link
Contributor

@BigFaceMaster BigFaceMaster commented Jul 22, 2018

翻译章节

《面试前期准备——算法》

变更文件

  • algorithms.json

  • algorithms.md

翻译进度

  • 45%

  • 0%

@S1ngS1ng S1ngS1ng added the ready for review Use when a translation (?) PR is ready for review label Jul 22, 2018
Copy link
Contributor

@S1ngS1ng S1ngS1ng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 所有的 markdown 语法都要改成 HTML 语法才行
  2. 建议采用 JavaScript 的语法举例
  3. 题目的描述,特别是有多个参数的时候,建议分开描述。先解释传入的每个参数的意义,然后再细致地描述题目逻辑。可以参考我的翻译:

"Create a function that takes two or more arrays and returns an array of the <dfn>symmetric difference</dfn> (<code>&xutri;</code> or <code>&oplus;</code>) of the provided arrays.",
"Given two sets (for example set <code>A = {1, 2, 3}</code> and set <code>B = {2, 3, 4}</code>), the mathematical term \"symmetric difference\" of two sets is the set of elements which are in either of the two sets, but not in both (<code>A &xutri; B = C = {1, 4}</code>). For every additional symmetric difference you take (say on a set <code>D = {2, 3}</code>), you should get the set with elements which are in either of the two the sets but not both (<code>C &xutri; D = {1, 4} &xutri; {2, 3} = {1, 2, 3, 4}</code>). The resulting array must contain only unique values (<em>no duplicates</em>).",
"Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
"知识提要:对称差 (Symmetric Difference),数学上,两个 <a href='https://baike.baidu.com/item/%E9%9B%86%E5%90%88/2908117' target='_blank'>集合</a> 的对称差是只属于其中一个集合,而不属于另一个集合的元素组成的集合,例如:集合 A = { 1, 2, 3} 和 B = { 2, 3, 4} 的对称差为 A &xutri; B = C = {1,4},。 集合论中的这个运算相当于布尔逻辑中的异或运算。<a href='https://baike.baidu.com/item/%E5%AF%B9%E7%A7%B0%E5%B7%AE' target='_blank'>百科</a>。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议把 对称差 的链接放到前面。

知识提要:<a href='https://baike.baidu.com/item/%E5%AF%B9%E7%A7%B0%E5%B7%AE' target='_blank'>对称差</a>(Symmetric Difference)。


既然是 JavaScript 平台,建议用 [1, 2, 3] 来表示数组。下同

"Given two sets (for example set <code>A = {1, 2, 3}</code> and set <code>B = {2, 3, 4}</code>), the mathematical term \"symmetric difference\" of two sets is the set of elements which are in either of the two sets, but not in both (<code>A &xutri; B = C = {1, 4}</code>). For every additional symmetric difference you take (say on a set <code>D = {2, 3}</code>), you should get the set with elements which are in either of the two the sets but not both (<code>C &xutri; D = {1, 4} &xutri; {2, 3} = {1, 2, 3, 4}</code>). The resulting array must contain only unique values (<em>no duplicates</em>).",
"Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
"知识提要:对称差 (Symmetric Difference),数学上,两个 <a href='https://baike.baidu.com/item/%E9%9B%86%E5%90%88/2908117' target='_blank'>集合</a> 的对称差是只属于其中一个集合,而不属于另一个集合的元素组成的集合,例如:集合 A = { 1, 2, 3} 和 B = { 2, 3, 4} 的对称差为 A &xutri; B = C = {1,4},。 集合论中的这个运算相当于布尔逻辑中的异或运算。<a href='https://baike.baidu.com/item/%E5%AF%B9%E7%A7%B0%E5%B7%AE' target='_blank'>百科</a>。",
"创建一个函数sym,输入两个或两个以上的数组作为参数,然后返回值为 **对称差** 的数组",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

然后返回值为 **对称差** 的数组 => 以数组的形式返回它们的对称差。

注意,这里用 markdown syntax 是不行的。如果要强调,也许要用 <em> 或者 <b> 这样的包裹起来

下同

"知识提要:对称差 (Symmetric Difference),数学上,两个 <a href='https://baike.baidu.com/item/%E9%9B%86%E5%90%88/2908117' target='_blank'>集合</a> 的对称差是只属于其中一个集合,而不属于另一个集合的元素组成的集合,例如:集合 A = { 1, 2, 3} 和 B = { 2, 3, 4} 的对称差为 A &xutri; B = C = {1,4},。 集合论中的这个运算相当于布尔逻辑中的异或运算。<a href='https://baike.baidu.com/item/%E5%AF%B9%E7%A7%B0%E5%B7%AE' target='_blank'>百科</a>。",
"创建一个函数sym,输入两个或两个以上的数组作为参数,然后返回值为 **对称差** 的数组",
"思路:设定两个数组 (例如:<code>A = {1, 2, 3}</code>,<code>B = {2, 3, 4}</code>,)作为参数传入,返回对称差数组(<code>A &xutri; B = C = {1, 4}</code>),且数组元素具有唯一性(没有重复项)。",
"如果你遇到了困难,请点击 <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>帮助</a>。请尽量编写属于你自己的代码。尝试一下 **结对编程** 会有意料不到的惊喜哦。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Compare and update the inventory stored in a 2D array against a second 2D array of a fresh delivery. Update the current existing inventory item quantities (in <code>arr1</code>). If an item cannot be found, add the new item and quantity into the inventory array. The returned inventory array should be in alphabetical order by item.",
"Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
"",
"比较和更新存储在 <a href='https://baike.baidu.com/item/%E4%BA%8C%E7%BB%B4%E6%95%B0%E7%BB%84' target='_blank'>2D数组 </a>中的库存,并将其与新交付的第二个2D数组进行比较。更新当前的库存项数量(arr1)。如果找不到项目,请将新项目和数量添加到库存数组中。返回的库存数组应该按照项目的字母顺序排列。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2D数组 => 二维数组


建议更新题目描述,见 review comments

@S1ngS1ng
Copy link
Contributor

@BigFaceMaster 另外,你添加了 .DS_Store 文件。请删除

@S1ngS1ng S1ngS1ng added the need update Use when a translation (?) PR has been reviewed and needs to address comments label Jul 24, 2018
Copy link
Contributor

@S1ngS1ng S1ngS1ng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

空格改一下。之前的 comments 也看一下,你还都没改。先别添加新的翻译内容了

},
{
"text": "<code>permAlone(\"aab\")</code> should return 2.",
"testString": "assert.strictEqual(permAlone('aab'), 2,'<code>permAlone(\"aab\")</code> should return 2.');"
"text": "<code>permAlone(\"aab\")</code> 应该返回 2 。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

半角字符与全角标点之间不应该添加空格。见群内讨论

所以这里是 应该返回 2。
下同

@@ -255,7 +255,7 @@
"<table class=\"table\"><tr><th><strong>Index</strong></th><th>0</th><th>1</th><th>2</th><th>3</th><th>4</th></tr><tr><td>Value</td><td>7</td><td>9</td><td>11</td><td>13</td><td>15</td></tr></table>",
"Below we'll take their corresponding indices and add them.",
"7 + 13 = 20 &#8594; Indices 0 + 3 = 3<br>9 + 11 = 20 &#8594; Indices 1 + 2 = 3<br>3 + 3 = 6 &#8594 Return <code>6</code>",
"Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514'target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
"如果你遇到了困难,请点击 <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514'target='_blank'> 帮助 </a>。你可以找人 “结对编程”,但不要因此放弃思考。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

见群内讨论。行内元素是否加空格取决于里面的内容。
中文引号两边也是不需要加空格的

如果你遇到了困难,请点击<a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514'target='_blank'>帮助</a>。你可以找人“结对编程”,但不要因此放弃思考。

"Create a function that takes two or more arrays and returns an array of the <dfn>symmetric difference</dfn> (<code>&xutri;</code> or <code>&oplus;</code>) of the provided arrays.",
"Given two sets (for example set <code>A = {1, 2, 3}</code> and set <code>B = {2, 3, 4}</code>), the mathematical term \"symmetric difference\" of two sets is the set of elements which are in either of the two sets, but not in both (<code>A &xutri; B = C = {1, 4}</code>). For every additional symmetric difference you take (say on a set <code>D = {2, 3}</code>), you should get the set with elements which are in either of the two the sets but not both (<code>C &xutri; D = {1, 4} &xutri; {2, 3} = {1, 2, 3, 4}</code>). The resulting array must contain only unique values (<em>no duplicates</em>).",
"Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
"知识提要:对称差 (Symmetric Difference),数学上,两个 <a href='https://baike.baidu.com/item/%E9%9B%86%E5%90%88/2908117'target='_blank'> 集合 </a> 的对称差是只属于其中一个集合,而不属于另一个集合的元素组成的集合,例如:集合 A = { 1, 2, 3} 和 B = { 2, 3, 4} 的对称差为 A &xutri; B = C = {1,4},。 集合论中的这个运算相当于布尔逻辑中的异或运算。<a href='https://baike.baidu.com/item/%E5%AF%B9%E7%A7%B0%E5%B7%AE'target='_blank'> 百科 </a>。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Symmetric Difference => 对称差分

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@huluoyang huluoyang changed the title 完成“面试前期准备-算法-Symmetric Difference” Translate algorithms Jul 24, 2018
@huluoyang huluoyang removed the ready for review Use when a translation (?) PR is ready for review label Jul 24, 2018
Copy link
Contributor

@S1ngS1ng S1ngS1ng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BigFaceMaster 之前的 comments 你还没有改,点开 Show outdated 看下。
比如数组的表示方式,markdown syntax 要删掉,以及<a>标签里面其实不需要加空格。
麻烦你更新下哈。内容方面应该没有问题了

@BigFaceMaster
Copy link
Contributor Author

已经根据建议 ,更改并优化。

Copy link
Contributor

@S1ngS1ng S1ngS1ng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks 👍

@S1ngS1ng S1ngS1ng added :shipit: ship it Use when a translation (?) PR is ready for shipping and removed need update Use when a translation (?) PR has been reviewed and needs to address comments labels Jul 31, 2018
"Create a function that takes two or more arrays and returns an array of the <dfn>symmetric difference</dfn> (<code>&xutri;</code> or <code>&oplus;</code>) of the provided arrays.",
"Given two sets (for example set <code>A = {1, 2, 3}</code> and set <code>B = {2, 3, 4}</code>), the mathematical term \"symmetric difference\" of two sets is the set of elements which are in either of the two sets, but not in both (<code>A &xutri; B = C = {1, 4}</code>). For every additional symmetric difference you take (say on a set <code>D = {2, 3}</code>), you should get the set with elements which are in either of the two the sets but not both (<code>C &xutri; D = {1, 4} &xutri; {2, 3} = {1, 2, 3, 4}</code>). The resulting array must contain only unique values (<em>no duplicates</em>).",
"Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
"知识提要:<a href='https://baike.baidu.com/item/%E5%AF%B9%E7%A7%B0%E5%B7%AE'target='_blank'>对称差 (Symmetric Difference)</a>,数学上,两个 <a href='https://baike.baidu.com/item/%E9%9B%86%E5%90%88/2908117'target='_blank'>集合</a> 的对称差分是只属于其中一个集合,而不属于另一个集合的元素组成的集合,例如:集合<code>let A = [ 1, 2, 3]</code>和<code>let B = [ 2, 3, 4]</code>的对称差分为<code>A &xutri; B = C = [ 1, 4]</code>,。 集合论中的这个运算相当于布尔逻辑中的异或运算。",
Copy link
Contributor

@huluoyang huluoyang Aug 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

知识提要👍
对称差分 => 对等差分

"Compare and update the inventory stored in a 2D array against a second 2D array of a fresh delivery. Update the current existing inventory item quantities (in <code>arr1</code>). If an item cannot be found, add the new item and quantity into the inventory array. The returned inventory array should be in alphabetical order by item.",
"Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
"",
"比较和更新存储在<a href='https://baike.baidu.com/item/%E4%BA%8C%E7%BB%B4%E6%95%B0%E7%BB%84'target='_blank'>二维数组</a>中的库存,并将其与新交付的第二个二维数组进行比较。更新当前的库存项数量(arr1)。如果找不到项目,请将新项目和数量添加到库存数组中。返回的库存数组应该按照项目的字母顺序排列。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

符号使用混乱,行文不够流畅。
请重新翻译。

@huluoyang huluoyang added need update Use when a translation (?) PR has been reviewed and needs to address comments and removed :shipit: ship it Use when a translation (?) PR is ready for shipping labels Aug 2, 2018
Copy link
Contributor

@S1ngS1ng S1ngS1ng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BigFaceMaster 内容上没啥大问题。但其他部分,不翻译的/不需要改的部分就不要改,保持和原文一样就行,否则后续很难做 diff。

格式问题记得参考 style-guide

"Create a function that takes two or more arrays and returns an array of the <dfn>symmetric difference</dfn> (<code>&xutri;</code> or <code>&oplus;</code>) of the provided arrays.",
"Given two sets (for example set <code>A = {1, 2, 3}</code> and set <code>B = {2, 3, 4}</code>), the mathematical term \"symmetric difference\" of two sets is the set of elements which are in either of the two sets, but not in both (<code>A &xutri; B = C = {1, 4}</code>). For every additional symmetric difference you take (say on a set <code>D = {2, 3}</code>), you should get the set with elements which are in either of the two the sets but not both (<code>C &xutri; D = {1, 4} &xutri; {2, 3} = {1, 2, 3, 4}</code>). The resulting array must contain only unique values (<em>no duplicates</em>).",
"Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
"知识提要:<a href='https://baike.baidu.com/item/%E5%AF%B9%E7%A7%B0%E5%B7%AE'target='_blank'>对称差 (Symmetric Difference)</a>,数学上,两个 <a href='https://baike.baidu.com/item/%E9%9B%86%E5%90%88/2908117'target='_blank'>集合</a> 的对称差分是只属于其中一个集合,而不属于另一个集合的元素组成的集合,例如:集合<code>let A = [ 1, 2, 3]</code>和<code>let B = [ 2, 3, 4]</code>的对称差分为<code>A &xutri; B = C = [ 1, 4]</code>,。 集合论中的这个运算相当于布尔逻辑中的异或运算。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

两个 <a href='https://baike.baidu.com/item/%E9%9B%86%E5%90%88/2908117'target='_blank'>集合</a> 的对称差分是只属于其中一个集合,

由于 <a> 里面和外面都是全角,因此 <a> 两边不需要加空格。


最后哪个 </code> 之后多了一个半角逗号。

"Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
"知识提要:<a href='https://baike.baidu.com/item/%E5%AF%B9%E7%A7%B0%E5%B7%AE'target='_blank'>对称差 (Symmetric Difference)</a>,数学上,两个 <a href='https://baike.baidu.com/item/%E9%9B%86%E5%90%88/2908117'target='_blank'>集合</a> 的对称差分是只属于其中一个集合,而不属于另一个集合的元素组成的集合,例如:集合<code>let A = [ 1, 2, 3]</code>和<code>let B = [ 2, 3, 4]</code>的对称差分为<code>A &xutri; B = C = [ 1, 4]</code>,。 集合论中的这个运算相当于布尔逻辑中的异或运算。",
"创建一个函数 sym,输入两个或两个以上的数组作为参数,然后返回值为<em>对称差分</em>的数组",
"思路:设定两个数组 (例如:<code>let A = [1, 2, 3]</code>,<code>let B = [2, 3, 4]</code>,)作为参数传入,返回对称差分数组(<code>A &xutri; B = C = [1, 4]</code>),且数组元素具有唯一性(没有重复项)。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

第一个括号里面, 之前不应该加逗号


且数组元素具有唯一性(没有重复项)。 =>
且数组中没有重复项。

"知识提要:<a href='https://baike.baidu.com/item/%E5%AF%B9%E7%A7%B0%E5%B7%AE'target='_blank'>对称差 (Symmetric Difference)</a>,数学上,两个 <a href='https://baike.baidu.com/item/%E9%9B%86%E5%90%88/2908117'target='_blank'>集合</a> 的对称差分是只属于其中一个集合,而不属于另一个集合的元素组成的集合,例如:集合<code>let A = [ 1, 2, 3]</code>和<code>let B = [ 2, 3, 4]</code>的对称差分为<code>A &xutri; B = C = [ 1, 4]</code>,。 集合论中的这个运算相当于布尔逻辑中的异或运算。",
"创建一个函数 sym,输入两个或两个以上的数组作为参数,然后返回值为<em>对称差分</em>的数组",
"思路:设定两个数组 (例如:<code>let A = [1, 2, 3]</code>,<code>let B = [2, 3, 4]</code>,)作为参数传入,返回对称差分数组(<code>A &xutri; B = C = [1, 4]</code>),且数组元素具有唯一性(没有重复项)。",
"如果你遇到了困难,请点击 <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514'target='_blank'>帮助</a>。你可以找人“结对编程”,但不要因此放弃思考。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同理,这里的 “帮助” 之前也不需要加空格。
但引号前是要加的。参考 style-guide

image

@@ -99,36 +100,36 @@
"id": "a56138aff60341a09ed6c480",
"title": "Inventory Update",
"description": [
"Compare and update the inventory stored in a 2D array against a second 2D array of a fresh delivery. Update the current existing inventory item quantities (in <code>arr1</code>). If an item cannot be found, add the new item and quantity into the inventory array. The returned inventory array should be in alphabetical order by item.",
"Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
"创建一个<a href='https://baike.baidu.com/item/%E4%BA%8C%E7%BB%B4%E6%95%B0%E7%BB%84'target='_blank'>二维数组</a>,比较并更新存储在<code>二维数组</code>中的”库存“元素,然后并将其与新产生的第二个二维数组进行对比,更新当前的”库存“项的数量(<code>arr1</code>),如果找不到这个对比对象,那么将新的对象和数量添加到“库存”数组中。注意:返回的“库存”数组应该是按照数组元素的首字母顺序排序",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的第一组引号好像用反了。。另外记得加空格

"For example, <code>aab</code> should return 2 because it has 6 total permutations (<code>aab</code>, <code>aab</code>, <code>aba</code>, <code>aba</code>, <code>baa</code>, <code>baa</code>), but only 2 of them (<code>aba</code> and <code>aba</code>) don't have the same letter (in this case <code>a</code>) repeating.",
"Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
"把一个字符串中的字符重新排列生成新的字符串,返回新生成的字符串里没有连续重复字符的字符串个数。连续重复只以单个字符为准。",
"例如:<code>aab</code>应该返回 2, 因为它总共有 6 种排列方式: <code>aab</code>, <code>aab</code>, <code>aba</code>, <code>aba</code>, <code>baa</code>, <code>baa</code>,但是其中只有 2 个没有连续重复的字符( 字符 a 是本例中的重复字符 ):<code>aba</code>,<code>aba</code>",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

全角符号之后不加空格。

"Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
"把一个字符串中的字符重新排列生成新的字符串,返回新生成的字符串里没有连续重复字符的字符串个数。连续重复只以单个字符为准。",
"例如:<code>aab</code>应该返回 2, 因为它总共有 6 种排列方式: <code>aab</code> <code>aab</code> <code>aba</code> <code>aba</code> <code>baa</code> <code>baa</code>,但是其中只有 2 个没有连续重复的字符( 字符 a 是本例中的重复字符 ):<code>aba</code><code>aba</code>",
"如果你遇到了困难,请点击 <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514'target='_blank'> 帮助 </a>。你可以找人” 结对编程 “,但不要因此放弃思考。"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你可以找人” 结对编程 “

这里引号用的也不对

],
"solutions": [
"function permAlone(str) {\n return permutor(str).filter(function(perm) {\n return !perm.match(/(.)\\1/g);\n }).length;\n}\n\nfunction permutor(str) {\n // http://staff.roguecc.edu/JMiller/JavaScript/permute.html\n //permArr: Global array which holds the list of permutations\n //usedChars: Global utility array which holds a list of \"currently-in-use\" characters\n var permArr = [], usedChars = [];\n function permute(input) {\n //convert input into a char array (one element for each character)\n var i, ch, chars = input.split(\"\");\n for (i = 0; i < chars.length; i++) {\n //get and remove character at index \"i\" from char array\n ch = chars.splice(i, 1);\n //add removed character to the end of used characters\n usedChars.push(ch);\n //when there are no more characters left in char array to add, add used chars to list of permutations\n if (chars.length === 0) permArr[permArr.length] = usedChars.join(\"\");\n //send characters (minus the removed one from above) from char array to be permuted\n permute(chars.join(\"\"));\n //add removed character back into char array in original position\n chars.splice(i, 0, ch);\n //remove the last character used off the end of used characters array\n usedChars.pop();\n }\n }\n permute(str);\n return permArr;\n}\n\npermAlone('aab');\n"
"function permAlone(str) {\n return permutor(str).filter(function(perm) {\n return !perm.match(/(.)\\1/g);\n }).length;\n}\n\nfunction permutor(str) {\n // http://staff.roguecc.edu/JMiller/JavaScript/permute.html\n //permArr: 全局数组:包含排列的列表 \ n //usedChars: 全局实用数组,其中一个列表包含 \"currently-in-use\"字符 var permArr = [], usedChars = [];\n function permute(input) {\n // 将输入参数转换成一个字符串数组 (每个字符都有一个元素)\n var i, ch, chars = input.split(\"\");\n for (i = 0; i < chars.length; i++) {\n // 从字符数组中获取并删除索引为\"i\"的字符 \n ch = chars.splice(i, 1);\n // 将删除的字符增加的使用字符的末尾 \n usedChars.push(ch);\n // 当char数组中没有其他字符添加时,添加使用的chars列表来排列排列 \n if (chars.length === 0) permArr[permArr.length] = usedChars.join(\"\");\n // 从char数组发送字符(减去上面删除的字符)进行置换 \n permute(chars.join(\"\"));\n // 将删除的数组添加回char数组中的原位置 \n chars.splice(i, 0, ch);\n //删除使用过的字符数组末尾使用的最后一个字符 \n usedChars.pop();\n }\n }\n permute(str);\n return permArr;\n}\n\npermAlone('aab');\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 solutions 是不需要翻译的。 @huluoyang 确认下?我记得这个只是用来执行判断的

@@ -233,7 +234,7 @@
"name": "index",
"contents": [
"function permAlone(str) {",
" return str;",
"return str;",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的缩进不要移除,这个是用来在编辑器中显示代码的,去掉之后缩进就没了。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里怕是插件的锅哦。。。

@@ -351,8 +352,8 @@
"head": [],
"tail": [
"function isSorted(arr) {",
" var check = (i) => (i == arr.length - 1) ? true : (arr[i] > arr[i + 1]) ? false : check(i + 1);",
" return check(0);",
"var check = (i) => (i == arr.length - 1) ? true : (arr[i] > arr[i + 1]) ? false : check(i + 1);",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里改了应该没事儿,但最好不要动,否则后续更新的时候会影响 diff 的判断

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

插件。。。

@S1ngS1ng
Copy link
Contributor

S1ngS1ng commented Aug 6, 2018

@BigFaceMaster 好 👍 把前面 comment 里提到的改下就好啦,没别的问题

@huluoyang huluoyang merged commit d69abd2 into FreeCodeCampChina:translate Aug 7, 2018
fs523577192 pushed a commit to fs523577192/challenges that referenced this pull request Aug 12, 2018
… translate)

Merge Request: functional-programming.json complete
Created By: @黄雨纯
Accepted By: @黄雨纯
URL: https://freecodecamp.coding.net/p/challenges/git/merge/10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need update Use when a translation (?) PR has been reviewed and needs to address comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants