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 397 / 402 1300
Distance query 350 / 360 1400
Robot on tree 290 / 311 1400
Heaviest edge 271 / 277 1500
Equal path 215 / 226 1500
Triplet 185 / 188 1500
Path update 205 / 210 1600
Second best minimum spanning tree 97 / 166 1700
Oggy and the cockroaches 32 / 48 1800