Skip to main content

Practice · 2 of 2

Lowest Common Ancestor

CHALLENGE
Difficulty: advanced+25 XP

**Bài toán.** A rooted tree (root 1). q queries LCA u v: print the LCA. ANC v k queries may also appear (same handler as the checkpoint). **Constraints:** 1 ≤ n, q ≤ 200 000. Depth equalization + synchronized descent, O(log n) per query.

Back to lesson: Practice: Lifting Drills