2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: afd15382cdfb22c9efe8b7de
|
|
|
|
|
title: DNA Pairing
|
|
|
|
|
isRequired: true
|
|
|
|
|
challengeType: 5
|
|
|
|
|
videoUrl: ''
|
|
|
|
|
localeTitle: DNA配对
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
2020-06-30 01:51:26 -07:00
|
|
|
|
<section id="description"> DNA链缺少配对元素。获取每个字符,获取其对,并将结果作为二维数组返回。 <a href="http://en.wikipedia.org/wiki/Base_pair" target="_blank">碱基对</a>是一对AT和CG。将缺少的元素与提供的字符匹配。将提供的字符作为每个数组中的第一个元素返回。例如,对于输入GCG,返回[[“G”,“C”],[“C”,“G”],[“G”,“C”]]字符及其对在一个中配对数组,并将所有数组分组到一个封装数组中。如果卡住,请记得使用<a href="https://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck-coding/19514" target="_blank">Read-Search-Ask</a> 。尝试配对程序。编写自己的代码。 </section>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
|
<section id="instructions">
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
tests:
|
|
|
|
|
- text: '<code>pairElement("ATCGA")</code>应返回<code>[["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]]</code> 。'
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert.deepEqual(pairElement("ATCGA"),[["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]]);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: '<code>pairElement("TTGAG")</code>应返回<code>[["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]]</code> 。'
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert.deepEqual(pairElement("TTGAG"),[["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]]);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: '<code>pairElement("CTCTA")</code>应返回<code>[["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]]</code> 。'
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert.deepEqual(pairElement("CTCTA"),[["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]]);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
function pairElement(str) {
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pairElement("GCG");
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|
|
|
|
|
</section>
|