• 汇编练习Complementary DNA


    Description:

    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 a 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).

    More similar exercise are found here http://rosalind.info/problems/list-view/ (source)

    DNA_strand ("ATTGC") # return "TAACG"
    
    DNA_strand ("GTAT") # return "CATA"



    SECTION .text
    global dna_strand
    extern strdup
    dna_strand:
      call strdup
      xor  rcx,rcx
      .b:movzx rdx,byte[rax+rcx]
         mov   dl,[.replace+rdx-'A']
         mov   [rax+rcx],dl
         inc   rcx
         cmp   byte[rax+rcx],0
      jne .b   
      ret
     .replace      db 'T',0,'G',0,0,0,'C'
     times 'T'-'H' db 0
                   db 'A'

    代码摘自:https://www.codewars.com/kata/554e4a2f232cdd87d9000038/solutions

    代码是codewar上面的,记录一下这总写法,过几天自己再来写一遍这道题,并且使用该方法

  • 相关阅读:
    Sony Z1 USB 调试
    消除“Unfortunately, System UI has stopped”的方法
    变动数据模拟cons
    string to integer
    single number
    罗马数字转为阿拉伯数字
    整数逆序
    回文数字
    回文字符串
    count and say
  • 原文地址:https://www.cnblogs.com/pppyyyzzz/p/13627776.html
Copyright © 2020-2023  润新知