Easy to understand C++ recursive code


#1

int Solution::isSameTree(TreeNode* A, TreeNode* B) {
    
    if(A==NULL && B==NULL)
        return 1;
   
    if(A==NULL || B==NULL)
        return 0;

    return isSameTree(A->left, B->left) && isSameTree(A->right, B->right) && A->val==B->val;
 
}