Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- knakul853
- */
- class Solution {
- public:
- bool isSameTree(TreeNode* p, TreeNode* q) {
- if(p == NULL || q == NULL)return p==q;
- if(p->val == q->val){
- return isSameTree(p->left, q->left) && isSameTree(p->right, q->right);
- }
- return false;
- }
- };
Add Comment
Please, Sign In to add comment