Module Lowest common ancestor (LCA)

Lowest common ancestor (LCA)

**Frequency: 8/10** In many cases where a problem involves querying a path on a tree, there is a high likelihood that the Lowest Common Ancestor (LCA) will be a crucial element in the solution. There are also a lot of problems involving LCA in the next module, Euler tour.

Resources

- [CP Algorithms: Lowest Common Ancestor - Binary Lifting](https://cp-algorithms.com/graph/lca_binary_lifting.html)

Problems

LCA 385 / 390 1300
Distance query 339 / 348 1400
Robot on tree 281 / 302 1400
Heaviest edge 263 / 269 1500
Equal path 207 / 218 1500
Triplet 176 / 180 1500
Path update 199 / 204 1600
Second best minimum spanning tree 94 / 161 1700
Oggy and the cockroaches 32 / 47 1800