Very easy CPP solution....try this

TreeNode* Solution::solve(TreeNode* A, TreeNode* B) {
if(A==NULL && B==NULL) // leaf node Case
return NULL;
if(A==NULL || B==NULL) // Corner Case
{
if(A==NULL)
return B;
else
return A;
}
A->val=A->val+B->val;
A->left=solve(A->left,B->left);
A->right=solve(A->right,B->right);
return A;
}

Click here to start solving coding interview questions