# My solution with python

• class Solution:
# @param {string} s
# @return {string[]}
def findRepeatedDnaSequences(self, s):
a=[]
ans=[]
if(len(s)<10):
return ans
for i in s:
if(i=='A'):
a.append(0)
if(i=='C'):
a.append(1)
if(i=='G'):
a.append(2)
if(i=='T'):
a.append(3)
b=[]
for i in range(len(a)-9):
temp=''
for j in range(10):
temp+=str(a[i+j])
b.append(temp)
dic={}
for i in b:
if dic.get(i)==None:
dic[i]=1
else:
dic[i]+=1
for j in dic.keys():
if dic[j]>1:
ans_temp=''
for i in range(10):
if(j[i]=='0'):
ans_temp+='A'
if(j[i]=='1'):
ans_temp+='C'
if(j[i]=='2'):
ans_temp+='G'
if(j[i]=='3'):
ans_temp+='T'
ans.append(ans_temp)
return ans

I'm a rookie and wish anyone who can help me improve it

• There is no need to transfer the sequences to int and transfer it back to string. Here is my modified solution:

``````def findRepeatedDnaSequences(self, s):
ans = []
if len(s) < 10:
return res
b = []    #in fact, the name of b here is confusing
for i in range(len(s) - 9):
b.append(s[i: i + 10])
dic = {}
for item in b:
dic[item] = dic.get(item, 0) + 1
for key in dic.keys():
if dic[key] > 1:
ans.append(key)
return ans``````

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.