8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9bb31e9 commit 8b8e045Copy full SHA for 8b8e045
October-LeetCoding-Challenge/17-Repeated-DNA-Sequences/Repeated-DNA-Sequences.cs
@@ -0,0 +1,14 @@
1
+public class Solution {
2
+ public IList<string> FindRepeatedDnaSequences(string s) {
3
+ if(s == null || s.Length == 0) return new List<string>();
4
+ var seen = new HashSet<string>();
5
+ var repeated = new HashSet<string>();
6
+ for(int i=0; i<s.Length-9; i++){
7
+ string curr = s.Substring(i, 10);
8
+ if(!seen.Add(curr)){
9
+ repeated.Add(curr);
10
+ }
11
12
+ return new List<string>(repeated);
13
14
+}
0 commit comments