Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool checkNodes(struct TreeNode* a, struct TreeNode* b)
- {
- if(a == NULL && b == NULL)
- {
- return true;
- }
- if(a == NULL || b == NULL)
- {
- return false;
- }
- if(a->val != b->val)
- {
- return false;
- }
- return checkNodes(a->left, b->right) && checkNodes(a->right, b->left);
- }
- bool isSymmetric(struct TreeNode* root) {
- if(root == NULL)
- {
- return true;
- }
- return checkNodes(root->left, root->right);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement