$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · hard · #292

What goes in the blank?

# union-find with path compression
def find(x):
    if parent[x] != x:
        parent[x] = ____(parent[x])
    return parent[x]

Answer: find (also accepted: find)

Recursing to the root and storing it in parent[x] flattens the tree for later lookups.
Play Problem Solving ▸