Improve Match Counting
This commit is contained in:
parent
c38e15ded6
commit
253a2daeac
@ -87,11 +87,14 @@ int countMatches(std::vector<std::string> &v1, std::vector<std::string> &v2) {
|
||||
shorterSize = v2.size();
|
||||
}
|
||||
|
||||
std::vector<std::string> copyOfv2 = v2;
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < shorterSize; i++) {
|
||||
for (int j = 0; j < shorterSize; j++) {
|
||||
if (v1[i] == v2[j]) {
|
||||
if (v1[i] == copyOfv2[j]) {
|
||||
count++;
|
||||
copyOfv2[j] = "I have been counted already";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user