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 325 / 329 1300
Distance query 288 / 295 1400
Robot on tree 236 / 256 1400
Heaviest edge 219 / 226 1500
Equal path 170 / 180 1500
Triplet 143 / 147 1500
Path update 171 / 175 1600
Second best minimum spanning tree 80 / 137 1700
Oggy and the cockroaches 17 / 29 1800