187. Repeated DNA Sequences
作者:互联网
class Solution {
public List<String> findRepeatedDnaSequences(String s) {
Set<String> set=new HashSet<String>();
Set<String> res=new HashSet<String>();
for(int i=0;i+10<=s.length();i++)
{
String str=s.substring(i,i+10);
if(set.contains(str))
res.add(str);
else
set.add(str);
}
return new ArrayList<String>(res);
}
}
转载于:https://www.cnblogs.com/asuran/p/7734050.html
标签:www,Set,DNA,HashSet,res,Repeated,set,187,new 来源: https://blog.csdn.net/weixin_33752045/article/details/94140082