Amazon interview question

Sliding window based question on array , Finding the ancestor of a root node in trees