Jane Street interview question

Question involving a tree structure and operations to find specified values.