MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / find

Method find

python/2709-greatest-common-divisor-traversal.py:7–10  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

5 self.count = n
6
7 def find(self, x):
8 if self.par[x] != x:
9 self.par[x] = self.find(self.par[x])
10 return self.par[x]
11
12 def union(self, x, y):
13 px, py = self.find(x), self.find(y)

Callers 1

unionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected