implement a function on a binary search that receives two nodes and returns its common ancestor.
Anonymous
Did you mean binary search tree? If yes, we can do next. Take first node, go up until the root and mark visited nodes (visited[cur_node] = true or something like that). Then do the same thing for the second node. Go up until we meet already visited node. This will be the answer.
Check out your Company Bowl for anonymous work chats.