Node* findlca(Node* root, Node* l, Node *r) {
    if(root == NULL) 
        return root;
    if(root == l || root == r) 
        return root;
    Node *left = findlca(root->left,l,r);
    Node *right = findlca(root->right,l,r);
    if(left && right)
        return root;
    return left ? left : right;
}
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄