6 line solution c++


#1

TreeNode* Solution::solve(TreeNode* A, TreeNode* B) {
if(!A) return B;
if(!B) return A;
A->val+=B->val;
A->left=solve(A->left,B->left);
A->right=solve(A->right,B->right);
return A;
}