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.
Press Submit to check your solution.
Back to lesson: Practice: Lifting Drills