Example
Input DNA: "CCTAGGACCAGGTT"
Output RNA: "UUGGACCAGGAUCC"
DNA (deoxyribonucleic acid) is the molecule that carries the genetic information of all known living organisms (life on exoplanets might be totally different!). The genetic information is stored as a sequence of nucleotides of which there are four: adenine (A), cytosine (C), guanine (G), and thymine (T). So a DNA sequence can be stored on a computer as a string of ATCG characters.
Certain DNA sequences contain the information required to syntheize proteins, and the first step in the process is to transcribe the DNA sequence into a ribonucleic acid (RNA) sequence. The transcription process is biochemically complex, however the resulting RNA sequence is simple: it's equal to the DNA sequence with all instances of T replaced with a U (uracil) and the sequence is reversed.
Given the DNA string as input, return the transcribed RNA string. Keep in mind that these sequences can be very long (the human genome is 3,088,286,401 characters or base pairs long!).
Once you've solved this problem check out RNA translation to learn how to translate RNA into amino acids.
Input: A string of ATCG characters representing a DNA sequence.
Output: The RNA sequence corresponding to the input DNA sequence.
Difficulty | Timesink | ||
---|---|---|---|
Function | rna(dna) |
You must be logged in to view your submissions.
Let us know what you think about this problem! Was it too hard? Difficult to understand? Also feel free to discuss the problem, ask questions, and post cool stuff on Discourse. You should be able see a discussion thread below. Would be nice if you don't post solutions in there but if you do then please organize and document your code well so others can learn from it.