Satisfiability of Equality Equations
Signals to notice
Brute force first
Try all possible value assignments — exponential. Each variable could take any value. That direct path helps you understand the question, but it tends to treat every possibility as brand new instead of learning from earlier steps.
The key insight
Union-Find: first, process all equalities (union a and b). Then check all inequalities — if a!=b but find(a)==find(b), it's unsatisfiable. Instead of recomputing the world every time, you preserve just enough context to let the next decision become obvious.
What must stay true
Equality is transitive (a==b, b==c ⟹ a==c), making Union-Find natural. After merging all equal variables, any inequality between two variables in the same set is a contradiction. As long as that statement keeps holding, you can trust the steps built on top of it.
Easy way to go wrong
Processing inequalities before equalities — equalities must be processed first because they constrain which variables must be equal. Then inequalities check for contradictions. The fix is usually to return to the meaning of each move, not just the steps themselves.