Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/algorithmzuo/algorithm-journey
/ find
Method
find
src/class165/Code03_Envy1.java:39–44 ·
view source on GitHub ↗
(int i)
Source
from the content-addressed store, hash-verified
37
public
static
boolean[] ans =
new
boolean[MAXN];
38
39
public
static
int
find(
int
i) {
40
while
(i != father[i]) {
41
i = father[i];
42
}
43
return
i;
44
}
45
46
public
static
void
union(
int
x,
int
y) {
47
int
fx = find(x);
Callers
2
union
Method · 0.95
compute
Method · 0.95
Calls
no outgoing calls
Tested by
no test coverage detected