Given a tree and queries, each asking for the LCA of two nodes and .
Using Euler tour + Sparse Table: - Preprocess: - Each query: Alternative: Binary lifting gives preprocess, query.
Better for smaller , worse for large . Constraints: up to , up to .