Description A researcher is analyzing DNA. A DNA can be represented as a string composed of the characters A, G, C, or T. One day, researchers found a strange DNA, which is Smooth Repeated DNA. The DNA is represented by a string that has infinite length. The string has a repeating pattern, i.e. the DNA string 0 is repeated an infinite number of times. For example, if 0 = "????", then = "???????????? . . . ". According to researchers, a DNA is said to be special if it contains substrings . Determine whether is a substring of . Squad Format A line containing the two strings 0 and . Output Format A line that determines whether it is a substring of . Issue “YES” if is a substring of . Output “NO” otherwise. Example Input and Output Input Example Example Output AGCT GC YES AGCT TA YES AGCT GT No AGCT TAGCTAGCT YES AGGACCTA CTAA YES Explanation Example In the first to fourth test case examples, is worth "???????????? . . . ". The part in bold is one of the locations of the substring found. The string "??" can be found under "???????????? . . . ". The string "??" can be found under "???????????? . . . ". The string “TAGCTAGCT” can be found under "???????????? . . . ". Task You are asked to come up with an algorithm that can solve a given problem. Provide an analysis of why your algorithm is correct, and write down the time complexity of your algorithm. Note that you are not asked to program, but you can attach your code as supporting evidence for your algorithm. Please answer the bottom question, and please don't reject. I need it in 60-90 minutes, thanks
Description
A researcher is analyzing DNA. A DNA can be represented as a string composed of the characters A, G, C, or T.
One day, researchers found a strange DNA, which is Smooth Repeated DNA. The DNA is represented by a string that has infinite length. The string has a repeating pattern, i.e. the DNA string 0 is repeated an infinite number of times. For example, if
0 = "????", then = "???????????? . . . ".
According to researchers, a DNA is said to be special if it contains substrings . Determine whether
is a substring of .
Squad Format
A line containing the two strings 0 and .
Output Format
A line that determines whether it is a substring of . Issue “YES” if
is a substring of . Output “NO” otherwise.
Example Input and Output
Input Example |
Example Output |
AGCT GC |
YES |
AGCT TA |
YES |
AGCT GT |
No |
AGCT TAGCTAGCT |
YES |
AGGACCTA CTAA |
YES |
Explanation Example
In the first to fourth test case examples, is worth "???????????? . . . ". The part in bold is one of the locations of the substring found. The string "??" can be found under "???????????? . . . ". The string "??" can be found under "???????????? . . . ". The string “TAGCTAGCT” can be found under "???????????? . . . ".
Task
You are asked to come up with an
Please answer the bottom question, and please don't reject. I need it in 60-90 minutes, thanks
Step by step
Solved in 3 steps with 3 images