Jane Street Interview Question

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