freeCodeCamp/curriculum/challenges/arabic/02-javascript-algorithms-an.../intermediate-algorithm-scri.../dna-pairing.arabic.md

3.0 KiB

id title isRequired challengeType videoUrl localeTitle
afd15382cdfb22c9efe8b7de DNA Pairing true 5 الحمض النووي الاقتران

Description

يفتقد حبل الحمض النووي عنصر الإقران. تأخذ كل حرف ، والحصول على زوجها ، وإرجاع النتائج كصفيف 2D. أزواج القاعدة هي زوج من AT و CG. تطابق العنصر المفقود مع الحرف المتوفر. قم بإرجاع الحرف المتوفر كعنصر الأول في كل صفيف. على سبيل المثال ، بالنسبة إلى مدخل GCG ، أرجع "" G "،" C "] ، [" C "،" G "] ، [" G "،" C " يتم إقران الحرف وزوجه في صفيف ، ويتم تجميع جميع المصفوفات في صفيف تغليف واحد. تذكر استخدام Read-Search-Ask إذا واجهتك مشكلة. حاول إقران البرنامج. اكتب الكود الخاص بك.

Instructions

Tests

tests:
  - text: 'يجب أن يعيد <code>pairElement(&quot;ATCGA&quot;)</code> <code>[[&quot;A&quot;,&quot;T&quot;],[&quot;T&quot;,&quot;A&quot;],[&quot;C&quot;,&quot;G&quot;],[&quot;G&quot;,&quot;C&quot;],[&quot;A&quot;,&quot;T&quot;]]</code> .'
    testString: 'assert.deepEqual(pairElement("ATCGA"),[["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]], "<code>pairElement("ATCGA")</code> should return <code>[["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]]</code>.");'
  - text: 'يجب أن يعيد <code>pairElement(&quot;TTGAG&quot;)</code> <code>[[&quot;T&quot;,&quot;A&quot;],[&quot;T&quot;,&quot;A&quot;],[&quot;G&quot;,&quot;C&quot;],[&quot;A&quot;,&quot;T&quot;],[&quot;G&quot;,&quot;C&quot;]]</code> .'
    testString: 'assert.deepEqual(pairElement("TTGAG"),[["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]], "<code>pairElement("TTGAG")</code> should return <code>[["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]]</code>.");'
  - text: 'يجب أن تعيد <code>pairElement(&quot;CTCTA&quot;)</code> <code>[[&quot;C&quot;,&quot;G&quot;],[&quot;T&quot;,&quot;A&quot;],[&quot;C&quot;,&quot;G&quot;],[&quot;T&quot;,&quot;A&quot;],[&quot;A&quot;,&quot;T&quot;]]</code> .'
    testString: 'assert.deepEqual(pairElement("CTCTA"),[["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]], "<code>pairElement("CTCTA")</code> should return <code>[["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]]</code>.");'

Challenge Seed

function pairElement(str) {
  return str;
}

pairElement("GCG");

Solution

// solution required