Python: Lowest Common Ancestor of a Binary Search Tree
Python 3 code to find the Lowest Common Ancestor of a Binary Search Tree def lowestCommonAncestor(root, p, q): """ :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode """ if root is None or p is None or q is None: return None if p.val > q.val: temp = p p =