首页 > 代码库 > Leetcode#100 Same Tree

Leetcode#100 Same Tree

原题地址

 

基本模拟题

 

代码:

1 bool isSameTree(TreeNode *p, TreeNode *q) {2         if (p && q)3             return p->val == q->val && isSameTree(p->left, q->left) && isSameTree(p->right, q->right);4         else5             return p == q;6 }

 

Leetcode#100 Same Tree