Build the PrimitiveMedium
Lowest Common Ancestor of a BST
Write `lowest_common_ancestor(root, p, q)` returning the deepest node that is an ancestor of both. Nodes are node objects, both present in the tree, and a node counts as its own ancestor.
In a general binary tree this needs a search of both subtrees. In a BST it does not: walk down, and the first node whose value lies between the two targets is the answer, because that is where their paths diverge. Using a general-tree algorithm here is a correct answer that misses the point of the question.
What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.