Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d7f5346

Browse files
Update DNA Pairing.md
1 parent 30e6886 commit d7f5346

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎Intermediate Algorithm Scripting/DNA Pairing.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,23 @@ function pairElement(str) {
6969

7070
// test here
7171
pairElement("GCG");
72+
73+
74+
console.log(~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~)
75+
76+
Also, there is another way to solve this problem:
77+
function pairElement(str) {
78+
return str.split('').map((element) =>
79+
(element === "A")
80+
? [element, "T"]
81+
: (element === "T")
82+
? [element, "A"]
83+
: (element === "G")
84+
? [element, "C"]
85+
: (element === "C")
86+
? [element, "G"]
87+
: false);
88+
89+
}
90+
// test here
91+
pairElement("GCG");

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /