MCPcopy Create free account
hub / github.com/ByteByteGoHq/coding-interview-patterns / find

Method find

python3/Graphs/connect_the_dots.py:24–28  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

22
23
24 def find(self, x) -> int:
25 if x == self.parent[x]:
26 return x
27 self.parent[x] = self.find(self.parent[x])
28 return self.parent[x]
29
30
31def connect_the_dots(points: List[List[int]]) -> int:

Callers 1

unionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected