Skip to content

Commit

Permalink
slight midification and removed the debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
haoel committed Mar 31, 2019
1 parent 4bffdab commit 1ebef5c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion algorithms/cpp/accountsMerge/AccountsMerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class Solution {
bool join(unordered_map<int, int>& emails_chains, int id1, int id2) {
int e1 = find(emails_chains, id1);
int e2 = find(emails_chains, id2);
if ( e1 != e2 ) emails_chains[e1] = id2;
if ( e1 != e2 ) emails_chains[e1] = e2;
return e1 == e2;
}
};
2 changes: 1 addition & 1 deletion algorithms/cpp/friendCircles/FriendCircles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Solution {
bool join(vector<int> &relations, int x, int y) {
int tx = find(relations, x);
int ty = find(relations, y);
if ( tx != ty ) relations[tx] = y;
if ( tx != ty ) relations[tx] = ty;
return tx != ty;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Solution {
char tx = find(x);
char ty = find(y);
if (tx != ty) {
eq_map[tx] = y;
eq_map[tx] = ty;
}
}

Expand All @@ -90,7 +90,6 @@ class Solution {
}
for (auto e : equations) {
if (e[1] == '!' && (e[0] == e[3] || find(e[0]) == find(e[3]) ) ) {
cout << e << " " << find(e[0]) << find(e[3]) << endl;
return false;
}
}
Expand Down

0 comments on commit 1ebef5c

Please sign in to comment.