Simple to understand in C++


#1
TreeNode* Solution::solve(TreeNode* A, TreeNode* B) {
    if(A==NULL && B==NULL)
        return NULL;
    else if(A==NULL)
        return B;
    else if(B==NULL)
        return A;
    else 
    {
        TreeNode* root = new TreeNode(A->val + B->val);
        root->left = solve(A->left,B->left);
        root->right = solve(A->right,B->right);
        return root;
    }
}