Tracks
/
ARM64 Assembly
ARM64 Assembly
/
Exercises
/
Protein Translation
Protein Translation

Protein Translation

Medium

Instructions

Your job is to translate RNA sequences into proteins.

RNA strands are made up of three-nucleotide sequences called codons. Each codon translates to an amino acid. When joined together, those amino acids make a protein.

In the real world, there are 64 codons, which in turn correspond to 20 amino acids. However, for this exercise, you’ll only use a few of the possible 64. They are listed below:

Codon Amino Acid
AUG Methionine
UUU, UUC Phenylalanine
UUA, UUG Leucine
UCU, UCC, UCA, UCG Serine
UAU, UAC Tyrosine
UGU, UGC Cysteine
UGG Tryptophan
UAA, UAG, UGA STOP

For example, the RNA string “AUGUUUUCU” has three codons: “AUG”, “UUU” and “UCU”. These map to Methionine, Phenylalanine, and Serine.

“STOP” Codons

You’ll note from the table above that there are three “STOP” codons. If you encounter any of these codons, ignore the rest of the sequence — the protein is complete.

For example, “AUGUUUUCUUAAAUG” contains a STOP codon (“UAA”). Once we reach that point, we stop processing. We therefore only consider the part before it (i.e. “AUGUUUUCU”), not any further codons after it (i.e. “AUG”).

Learn more about protein translation on Wikipedia.

Output format

Output the protein sequence as a null-terminated string, with a newline character after every protein.

An example output would be "Methionine\nPhenylalanine\nSerine\n"

If the input is invalid, output an empty string.


Source

Tyler Long
Edit via GitHub The link opens in a new window or tab
ARM64 Assembly Exercism

Ready to start Protein Translation?

Sign up to Exercism to learn and master ARM64 Assembly with 77 exercises, and real human mentoring, all for free.

Deep Dive into Protein Translation!

Explore 11 different ways to solve this exercise, including imperative approaches, functional ideas like pattern matching, recursion, and higher order functions, and some low-level coding in C++ and Assembly.