Significance:
DNA is double-stranded and antiparallel, so any tool that works with real genomic data — primer design, aligners like BWA/Bowtie, restriction mapping — must be able to compute the reverse complement to check both strands. PCR primer design literally cannot be done correctly without this operation.
Statement
Given a DNA string, return its reverse complement: first take the complement of each base (A↔T, C↔G), then reverse the resulting string (equivalently, reverse first then complement — both yield the same answer).
Sample Input
AAAACCCGGT
Sample Output
ACCGGGTTTT
Constraints
- `1 ≤ length(DNA) ≤ 1000`
You can create a dictionary for complements and use a loop or list comprehension.
My Notes
Log in to save personal notes.
Console output will appear here when you click Run Code or Submit...