Groups
Category
Think Backwards is a problemโsolving pattern where you reverse time or direction so hard deletions become easy insertions and the final state becomes the starting point.
A DSU with weighted edges (also called a potential or difference-constraint union-find) maintains relative values between elements while still supporting near-constant-time merges and finds.