Find the lowest common ancestor (LCA) of two nodes in a binary tree. The LCA is the lowest node that has both p and q as descendants.
Finding LCA of nodes with values 5 and 1
-
3
p
5
q
1
6
2
0
8
7
4