标签:
https://leetcode.com/problems/same-tree/
/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ bool isSameTree(struct TreeNode* p, struct TreeNode* q) { if (p == NULL) return q == NULL; return q != NULL && p->val == q->val && isSameTree(p->left, q->left) && isSameTree(p->right, q->right); }
标签:
原文地址:http://www.cnblogs.com/brayden/p/5305595.html