MCPcopy Create free account
hub / github.com/Hsinha11/Leetcode-solutions / find

Method find

MinimizeHammingDistance/MinimizeHammingDistance.cpp:15–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13 for (int i = 0; i < n; i++) parent[i] = i;
14 }
15 int find(int x) {
16 if (parent[x] != x) parent[x] = find(parent[x]);
17 return parent[x];
18 }
19 void unite(int x, int y) {
20 int rx = find(x), ry = find(y);
21 if (rx == ry) return;

Callers 7

minimalKSumMethod · 0.45
rotateStringMethod · 0.45
maximumSubarraySumMethod · 0.45
strStrMethod · 0.45
strStrMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected