Graph Theory37 sections · 1633 units
Open in Course

Lessons - Blood Cousins

(Combining techniques)

Lesson: some problems need multiple techniques working together. Do not limit yourself to one tool.

This problem uses LCA to traverse ancestors (find the node at a specific depth above v) and Euler Tour to count nodes in subtrees (count how many nodes at depth d fall in a subtree range).

Neither technique alone is enough. When a problem asks about ancestors AND subtree ranges, think about combining LCA with Euler Tour. Each handles one part of the query.