public class Solution {
public List<String> findRepeatedDnaSequences(String s) {
List<String> res = new LinkedList<String>();
Set<String> explored = new HashSet<String>();
Set<String> repeat = new HashSet<String>();//avoid repetition in res
for( int i = 0; i < s.length() - 9; i++){
String temp = s.substring(i,i + 10);
if(!explored.add(temp) && repeat.add(temp)){
res.add(temp);
}
}
return res;
}
}