My issue
Cant solve
My code
# cook your dish here
Learning course: Strings using Python
Problem Link: DNA Storage Practice Problem in - CodeChef
Cant solve
# cook your dish here
Learning course: Strings using Python
Problem Link: DNA Storage Practice Problem in - CodeChef
@smitajha7701
plzz refer the following solution for better understanding
# cook your dish here
test_case = int(input())
for i in range(test_case):
seq = int(input())
string = input()
iter = seq - int(seq/2)
i = 0
while(i<iter):
if string[i] == '0' and string[i+1] == '0':
string = string.replace('00','A', 1)
elif string[i] == '0' and string[i+1] == '1':
string = string.replace('01','T', 1)
elif string[i] == '1' and string[i+1] == '0':
string = string.replace('10','C', 1)
elif string[i] == '1' and string[i+1] == '1':
string = string.replace('11','G', 1)
i += 1
print(string)
Here is another Python Solution for DNA Storage
# cook your dish here
t = int(input())
for _ in range (t) :
n = int(input())
s = str(input())
a = 0
dna = ''
for i in s :
if s[a:a+2] == '00' :
dna = dna + 'A'
if s[a:a+2] == '01' :
dna = dna + 'T'
if s[a:a+2] == '10' :
dna = dna + 'C'
if s [a:a+2] == '11' :
dna = dna + 'G'
a = a + 2
print(dna)