<jupyter_start><jupyter_text>Lowest Common Ancestor Find the lowest common ancestor of two nodes in the tree.Lowest common ancestor is the loweest node in which the two provided nodes are decendents. For example in the tree below the selected nodes of 1 and 6 give us a lowest common ancestor of 5 as its the lowest amount in which both nodes are decendents.Given the following binary tree:        5       / \      2   6     / \    1   3         \          4            Try finding the Lowest Common Ancestor<jupyter_code>def lowest_common_ancestor(node):
    """
    Determine the lowest common ancestor

    Args:
       tree(object): A BST object
    Returns:
       int: Lowest shared ancestor
    """
    pass<jupyter_output><empty_output><jupyter_text>Test Cases<jupyter_code>class Tree:
    def __init__(self, value, left = None, right = None):
        self.left = left
        self.right = right
        self.value = value

    def __str__(self):
        return str(self.value)
        
f = Tree(4)
e = Tree(3, None, f)

d = Tree(1)
b = Tree(2, d, e)

c = Tree(6)
a = Tree(5, b, c)

my_tree = a

print ("Pass" if 2 == lowest_common_ancestor(my_tree, 1, 4) else "Fail")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08291873963515754, 'fraction_numerical': 0.014925373134328358, 'mean_word_length': 2.736842105263158, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '609524', 'license': 'MIT', 'n_tokens_mistral': 397, 'n_tokens_neox': 380, 'n_words': 141, 'path': 'trees/Practice Lowest Common Ancestor.ipynb', 'repo_name': 'PRkudupu/Algo-python', 'size': '1206'}