-
You are given pointer to the root of the binary search tree and two values v1 and v2. You need to return the lowest common ancestor (LCA) of v1 and v2 in the binary search tree.
-
Instance format:
- The first line contains an integer, n, the number of nodes in the tree.
- The second line contains n space-separated integers representing node, data values.
- The third line contains two space-separated integers, v1 and v2.
-
Input:
6
4 2 3 1 7 6
1 7
- Output:
[reference to node 4]
- Running an instance:
python main.py "path_instance"
- Example: running an instance "input1":
python main.py instances/input1