Lowest common ancestor in a search tree
root is a binary search tree containing both a and b. Write lca(root, a, b) that
returns the value of their lowest common ancestor: the deepest node that has both among
its descendants (a node counts as its own descendant).
lca([6, 2, 8, 0, 4, 7, 9, None, None, 3, 5], 2, 8) -> 6
lca([6, 2, 8, 0, 4, 7, 9, None, None, 3, 5], 2, 4) -> 2
lca([6, 2, 8, 0, 4, 7, 9, None, None, 3, 5], 3, 5) -> 4
The point is to practise using the BST rule to walk down without searching both sides.
def lca(root, a, b):
...