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         else
5             return p == q;
6 }
原文地址:https://www.cnblogs.com/boring09/p/4267205.html