国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

DNA Pairing——Easy algorithm challenge

luxixing / 957人閱讀

Problem Explanation:

You will get a DNA strand sequence and you need to get the pair and return it as a 2D array of the base pairs. Keep in mind that the provided strand should be first always.

pairElement("ATCGA") should return [["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]].
pairElement("TTGAG") should return [["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]].
pairElement("CTCTA") should return [["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]].

basic solution:
function pairElement(str) {
  // Return each strand as an array of two elements, the original and the pair.
  var paired = [];

  // Function to check with strand to pair.
  var search = function(char) {
    switch (char) {
      case "A":
        paired.push(["A", "T"]);
        break;
      case "T":
        paired.push(["T", "A"]);
        break;
      case "C":
        paired.push(["C", "G"]);
        break;
      case "G":
        paired.push(["G", "C"]);
        break;
    }
  };

  // Loops through the input and pair.
  for (var i = 0; i < str.length; i++) {
    search(str[i]);
  }

  return paired;
}

// test here
pairElement("GCG");
Intermediate Code Solution:
function pairElement(str) {
  //define a map object with all pair possibilities 
  var map = {T:"A", A:"T", G:"C", C:"G"};
  //split str into a char Array
  strArr = str.split("");
  //replace each Array item with a 2d Array using map
  for (var i=0;i

https://forum.freecodecamp.or...

文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請注明本文地址:http://m.specialneedsforspecialkids.com/yun/84106.html

相關(guān)文章

  • Missing letters——Easy algorithm challenge

    摘要:并看不懂我不會(huì)到處亂說。好吧我努力拆解一下這個(gè)正則是什么意思匹配字符串的開始重復(fù)一次或更多次匹配除了以外的任意字符原文 problem: You will create a program that will find the missing letter from a string and return it. If there is no missing letter, the p...

    stormgens 評論0 收藏0
  • FreeCodeCamp中級算法題答案

    摘要:法一法二使用給定的參數(shù)對句子執(zhí)行一次查找和替換,然后返回新句子。法一法二把指定的字符串翻譯成。在每一個(gè)數(shù)組中將給定的字母作為第一個(gè)堿基返回。法一后項(xiàng)減去前項(xiàng)法二檢查一個(gè)值是否是基本布爾類型,并返回或。基本布爾類型即和。 Diff Two Arrays 比較兩個(gè)數(shù)組,然后返回一個(gè)新數(shù)組,該數(shù)組的元素為兩個(gè)給定數(shù)組中所有獨(dú)有的數(shù)組元素。換言之,返回兩個(gè)數(shù)組的差異。 function dif...

    leonardofed 評論0 收藏0
  • 每日一道算法題 - 反轉(zhuǎn)字符串(easy-3)

    摘要:規(guī)則使用語言,讓函數(shù)獲取傳遞的參數(shù),并以相反的順序返回字符串。測試用例思路方法通過把字符串轉(zhuǎn)換成數(shù)組,并使用數(shù)組的反轉(zhuǎn)數(shù)組,然后使用重新拼接成字符串方法向后循環(huán)字符串或字符數(shù)組以生成新字符串 雖然都是很簡單的算法,每個(gè)都只需5分鐘左右,但寫起來總會(huì)遇到不同的小問題,希望大家能跟我一起每天進(jìn)步一點(diǎn)點(diǎn)。更多的小算法練習(xí),可以查看我的文章。 規(guī)則 Using the JavaScript l...

    xfee 評論0 收藏0
  • 谷歌推出開源工具DeepVariant,用深度學(xué)習(xí)識(shí)別基因變異

    摘要:今天推出了一個(gè)名叫的開源工具,用深度神經(jīng)網(wǎng)絡(luò)來從測序數(shù)據(jù)中快速較精確識(shí)別堿基變異位點(diǎn)。今天,團(tuán)隊(duì),聯(lián)合同屬于旗下的生命科學(xué)兄弟公司,用了兩年多時(shí)間,研發(fā)出了一個(gè)名叫的開源工具,專門用深度神經(jīng)網(wǎng)絡(luò)來識(shí)別結(jié)果中測序數(shù)據(jù)里這些堿基變異位點(diǎn)。 Google今天推出了一個(gè)名叫DeepVariant的開源工具,用深度神經(jīng)網(wǎng)絡(luò)來從DNA測序數(shù)據(jù)中快速較精確識(shí)別堿基變異位點(diǎn)。學(xué)科研究的革命性進(jìn)展,特別是基因...

    raledong 評論0 收藏0

發(fā)表評論

0條評論

最新活動(dòng)
閱讀需要支付1元查看
<