Identical Trees Easy Recursive C++ solution


#1
bool same(TreeNode* A, TreeNode* B){
 
if(A==NULL || B==NULL) 
    return A==B;

if(A->val!=B->val) 
    return 0;

return same(A->left, B->left) && same(A->right, B->right);

}

int Solution::isSameTree(TreeNode* A, TreeNode* B) {
return same(A, B);
}