Just 3 lines code


#1

int Solution::isSameTree(TreeNode* A, TreeNode* B)
{
if(A==NULL&&B==NULL)
return 1;
return (A&&B&&(A->val==B->val))&&isSameTree(A->left,B->left)&&isSameTree(A->right,B->right);
return 0;
}