Image Explanation🏆 - [Recursive & Non-Recursive] - Complete Intuition
Video Solution\nhttps://youtu.be/41j4iR4Gx9s\n\n# Approach & Intuition\n\n\n\n\n\n\n\n\n\n\n\n\n# Recursive Code\n\nclass Solution {\npublic:\n    bool isSymmet
# Video Solution\nhttps://youtu.be/41j4iR4Gx9s\n\n# Approach & Intuition\n![image.png](https://assets.leetcode.com/users/images/a0ec0746-4ddd-4dec-adbd-d540f823e889_1678669824.4317465.png)\n![image.png](https://assets.leetcode.com/users/images/a7825991-e7bf-44b1-ba38-c68853372580_1678669848.2439427.png)\n![image.png](https://assets.leetcode.com/users/images/7065f13f-bb82-4066-983e-cba9fc6239ab_1678669858.1537697.png)\n![image.png](https://assets.leetcode.com/users/images/c86dff88-7545-47af-a3ee-214e784692ff_1678669864.8307462.png)\n![image.png](https://assets.leetcode.com/users/images/8f319a20-de8c-496c-9b8b-a0594c51114e_1678669872.3450804.png)\n![image.png](https://assets.leetcode.com/users/images/a1a5be50-9390-4d6a-9019-08f2eb5dae6f_1678669881.0141463.png)\n![image.png](https://assets.leetcode.com/users/images/401aedaf-4111-4649-81c8-16282f60662a_1678669890.8298717.png)\n![image.png](https://assets.leetcode.com/users/images/a2194d4e-58e3-45ec-9f0b-79968f851827_1678669898.3149576.png)\n![image.png](https://assets.leetcode.com/users/images/01d99578-7858-415f-9e4f-931f458bf59c_1678669906.1509514.png)\n![image.png](https://assets.leetcode.com/users/images/da50d440-dc6b-4c47-a46e-b4a5376151b3_1678669914.0028672.png)\n\n\n# Recursive Code\n```\nclass Solution {\npublic:\n    bool isSymmetricHelper(TreeNode* leftNode, TreeNode* rightNode){\n        if(leftNode==NULL && rightNode==NULL) return true;\n        if(leftNode==NULL || rightNode==NULL || leftNode->val != rightNode->val) return false;\n        \n        return isSymmetricHelper(leftNode->left, rightNode->right) && isSymmetricHelper(leftNode->right, rightNode->left);\n    }\n\n    bool isSymmetric(TreeNode* root) {\n        if(root == NULL) return true;\n        return isSymmetricHelper(root->left, root->right);\n    }\n};\n```\n\n# Non-Recursive Code\n```\nclass Solution {\npublic:\n    bool isSymmetric(TreeNode* root) {\n        if(root == NULL) return true;\n\n        queue<TreeNode*> q;\n        q.push(root->left);\n        q.push(root->right);\n        while(!q.empty()){\n            TreeNode* leftNode = q.front();\n            q.pop();\n            TreeNode* rightNode = q.front();\n            q.pop();\n\n            if(leftNode==NULL && rightNode==NULL) continue;\n            if(leftNode==NULL || rightNode==NULL || leftNode->val != rightNode->val) return false;\n            q.push(leftNode->left);\n            q.push(rightNode->right);\n            q.push(leftNode->right);\n            q.push(rightNode->left);\n        }\n        return true;\n    }\n};\n```
['C++']