Find Least common ancestor for given tree. Each node has int value and link to parent.
Anonymous
2. Another approach is calculate depth of each node and then mode the node which is more depth by depth difference. Later traverse both node pointer at the same time until both node has same parent
Check out your Company Bowl for anonymous work chats.