id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > getBinaryRNA
prev  |  next  |  chance

Write a method that accepts a String representing an RNA sequence. Return that sequence as a integer value based on the binary representation of each nitrogenous bases in the RNA. These bases are encoded according to the following scheme: binary 00='U', binary 01='C', binary 10='A', and binary 11='G'. This uses a straight-sequential reading of the RNA sequence, so the binary digits are in the same order as the nitrogenous base letters. For example, "UAC" is equivalent to the binary number 001001 which, in decimal, is the number 9. "GCA" is equivalent to the binary number 110110 which, in decimal, is the number 54. You may assume only valid letters (U, C, A, G) will be in the 'sequence' string. You do NOT have to check to see if the sequence makes sense in terms of actual possible RNA sequences.


getBinaryRNA("U") → 0
getBinaryRNA("C") → 1
getBinaryRNA("A") → 2

...Save, Compile, Run (ctrl-enter)

public int getBinaryRNA(String sequence) }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 220

Copyright Nick Parlante 2017 - privacy