8000 Add C# solutions · xiaodi17/Leetcode@8b8e045 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8b8e045

Browse files
committed
Add C# solutions
1 parent 9bb31e9 commit 8b8e045

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)
0