Available question text
Given a rooted tree as a parent[] array, preprocess it to efficiently answer many queries asking for the k-th ancestor of a node (return -1 if it doesn't exist). The core challenge is supporting up to ~5·10^4 nodes/queries by using a log-depth jump-pointer (binary lifting) structure to achieve fast queries after preprocessing.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1483. Kth Ancestor of a Tree Node
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source