his solution is log(n) (balanced tree) and very intuitive and simple.
1
Anonymous
May 15, 2014
Find path to each of the two nodes and load both paths into the arraylist. Loop over arraylists and find the common nodes in the path. Pick the last common node.
1
Anonymous
Jun 15, 2014
this is to much extensive..you should use a recursive solution.