dna reverse

简介: dna reverse
Deoxyribonucleic acid (DNA) is a chemical found in the nucleus of cells and carries the "instructions" for the development and functioning of living organisms.
If you want to know more http://en.wikipedia.org/wiki/DNA
In DNA strings, symbols "A" and "T" are complements of each other, as "C" and "G". You have function with one side of the DNA (string, except for Haskell); you need to get the other complementary side. DNA strand is never empty or there is no DNA at all (again, except for Haskell).
DNAStrand ("ATTGC") # return "TAACG"
DNAStrand ("GTAT") # return "CATA"

代码

function DNAStrand(dna){
    function switch(x){
        switch (x){
            case "A":
                return "T";break;
            case "T":
                return "A";break;
            case "G":
                return "C";break;
            case "C":
                return "G";break;
        }
    }
    for(var i= 0,r='',l=dna.length;i<l;i++){
        r+=switch(dna[i])
    }
    return r
}
目录
相关文章
|
6月前
|
机器学习/深度学习 算法 计算机视觉
SORT新方法AM-SORT | 超越DeepSORT/CO-SORT/CenterTrack等方法,成为跟踪榜首
SORT新方法AM-SORT | 超越DeepSORT/CO-SORT/CenterTrack等方法,成为跟踪榜首
278 0
|
6月前
【每日一题Day369】LC187重复的DNA序列 | 字符串哈希
【每日一题Day369】LC187重复的DNA序列 | 字符串哈希
47 1
|
11月前
[HDCTF2019]Maze(初识逆向)
[HDCTF2019]Maze(初识逆向)
182 1
|
5月前
|
人工智能
技术心得:区间检测(range)
技术心得:区间检测(range)
34 0
|
6月前
leetcode-187:重复的DNA序列
leetcode-187:重复的DNA序列
51 0
华为机试HJ63:DNA序列
华为机试HJ63:DNA序列
word中列表序列隔空不同的简单解决方案
word中列表序列隔空不同的简单解决方案
125 0
word中列表序列隔空不同的简单解决方案
|
算法 JavaScript
DNA sequence(映射+BFS)
Problem Description The twenty-first century is a biology-technology developing century. We know that a gene is made of DNA.
1171 0