Problem 1483 · Hard

Kth Ancestor of a Tree Node

Precompute jumps of 1, 2, 4 and so on up the tree, then answer each query by combining the jumps that spell k in binary.

Open the interactive visualisation