Solve lowest common ancestor