TopcoderArchiveVisit Topcoder
Archive
Algorithm problem

BetaEasy

Problem statement, definition, constraints, and public examples.

Problem Statement

Class Name:  BetaEasy
Method Name: solve
Arg Types:   String
Return Type: String

Implement a class BetaEasy, which contains a method solve. solve takes a String
representing a strand of DNA and returns the complement of that strand, as a
String.

DNA is composed of the following four bases: adenine, guanine, thymine, and
cytosine.  Two strands of DNA are considered complements of each other if all
of the following conditions are met:
     -   they are of equal length
-   for each adenine in the first strand, a thymine is located in the
exact same position of the second strand
-   for each thymine in the first strand, an adenine is located in the
exact same position of the second strand
-   for each guanine in the first strand, a cytosine is located in the
exact same position of the second strand
-   for each cytosine in the first strand, a guanine is located in the
exact same position of the second strand

In both the input String and return String, let A stand for adenine, T for
thymine, C for cytosine and G for guanine and let each character in the String
represent a position in the DNA strand.

Here is the method signature:
public String solve(String strStrand);

* strStrand has length 1 to 50, inclusive.
* strStrand contains only the characters 'A', 'T', 'C', and 'G'.

Examples:
* If the input is "GAAACT", the method should return "CTTTGA"
* If the input is "ACCAAAAGCTGCAGTATGA", the method should return
"TGGTTTTCGACGTCATACT"
* If the input is "TAGGTCTCACTTAGCTTTCGTCCCTATAGTATATAGCTCCCAACCATCCA", the
method should return "ATCCAGAGTGAATCGAAAGCAGGGATATCATATATCGAGGGTTGGTAGGT"

GTGTGTGTGT

Definition

Class:
BetaEasy
Method:
solve
Parameters:
String
Returns:
String
Method signature:
String solve(String param0)
(be sure your method is public)

Constraints

    Examples

      No public sample cases were explicitly marked for this problem in the original data.

      Back to all problems