Lowest Common Ancestor of a Binary Search Tree
Asked at Meta · Coding Questions · Difficulty: Easy
You are given the values to insert (in order) into a binary search tree, and two values `p` and `q` that are both present. Build the BST, then return the value of the lowest common ancestor of `p` and `q` (a node is a descendant of itself).
Loading the problem…