add Lowest Common Ancestor code