if(!pRoot1&&!pRoot2) return true;是对的,只是要多加几个判断: if (!pRoot1 && !pRoot2 ) return true; if (pRoot1 && !pRoot2 ) return true; if (!pRoot1 && pRoot2 ) return false; if (pRoot1->val != pRoot2->val)return false;
点赞

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务