-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDNAMatching.cpp
More file actions
59 lines (49 loc) · 1.04 KB
/
DNAMatching.cpp
File metadata and controls
59 lines (49 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <numeric>
using namespace std;
class DNAMatching {
public:
string rev(string s) {
string ret = s;
int i, n = ret.size();
reverse(ret.begin(), ret.end());
for (i=0; i<n; i++) {
if (ret[i] == 'A')
ret[i] = 'T';
else if (ret[i] == 'T')
ret[i] = 'A';
else if (ret[i] == 'C')
ret[i] = 'G';
else if (ret[i] == 'G')
ret[i] = 'C';
}
return ret;
}
int getMaxSize(vector <string> dna) {
int i, j;
for (i=0; i<dna.size(); i++) {
string tmp = rev(dna[i]);
for (j=0; j<dna.size(); j++)
if (i != j)
if (tmp == dna[j])
dna.erase(dna.begin() + j);
}
return dna.size();
}
};
// Powered by FileEdit
// Powered by TZTester 1.01 [25-Feb-2003]
// Powered by CodeProcessor