Lowest Common Ancestor Of A Binary Search Tree, is a LeetCode problem. In this post we will see how we can solve this challenge in Python

Problem Description

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.

According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes v and w as the lowest node in T that has both v and w as descendants (where we allow a node to be a descendant of itself).”

   /              \
___2__     ....

You can find the full details of the problem Lowest Common Ancestor of a Binary Search Tree at LeetCode

Solution: Please check the main.py snippet for the solution.

This solution originally posted at: Github by @kamyu104