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.
2 parents e91619b + 631cee4 commit 8f72bedCopy full SHA for 8f72bed
src/main/java/g3301_3400/s3378_count_connected_components_in_lcm_graph/Solution.java
@@ -25,13 +25,13 @@ public int find(int u) {
25
if (parent[u] == u) {
26
return u;
27
}
28
- return parent[u] = find(parent[u]);
+ parent[u] = find(parent[u]);
29
+ return parent[u];
30
31
32
public void union(int u, int v) {
33
int parentU = find(u);
34
int parentV = find(v);
-
35
if (parentU != parentV) {
36
totalComponents--;
37
if (rank[parentU] == rank[parentV]) {
0 commit comments