Using binary lifting, you can answer LCA queries in time. The algorithm has two steps: bring both nodes to the same depth, then jump them upward together until they meet. Step : If one node is deeper, use binary lifting to bring it up to the same level as the other. This takes jumps. Step : Now both nodes are at the same depth. Jump them upward together, taking the largest possible jump that keeps them in different subtrees.
When you cannot jump anymore without making them the same node, their parent is the LCA. Why does this work? You are finding the highest point where they are still in different subtrees. One step above that point, they are in the same subtree, which means you have found their lowest common ancestor.