题目链接:click~
/*题意:判断两个树是否相同*/
class Solution {
public:
bool isSameTree(TreeNode *p, TreeNode *q) {
if( !( (p && q && p->val == q->val) || (p == NULL && q == NULL) ) ) return false;
if(p == NULL && q == NULL) return true;
return isSameTree(p->right, q->right) && isSameTree(p->left, q->left);
}
};