Created
October 22, 2015 19:55
-
-
Save ArielLeslie/f1b92fdec08d5227669a to your computer and use it in GitHub Desktop.
Bonfire: DNA Pairing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pair(str) { | |
var pairs = [['A', 'T'], ['C', 'G']]; | |
var myPairs = []; | |
for (i = 0; i < str.length; i++){ | |
for(j = 0; j < pairs.length; j++){ | |
var index = pairs[j].indexOf(str[i]); | |
if (index >= 0) { | |
myPairs.push([pairs[j][index], pairs[j][3%(index+2)]]); | |
} | |
} | |
} | |
return myPairs; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment