<p>Given the <code>root</code> of a binary tree, <em>check whether it is a mirror of itself</em> (i.e., symmetric around its center).</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2021/02/19/symtree1.jpg" style="width: 354px; height: 291px;" />
<pre>
<strong>Input:</strong> root = [1,2,2,3,4,4,3]
<strong>Output:</strong> true
</pre>

<p><strong class="example">Example 2:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2021/02/19/symtree2.jpg" style="width: 308px; height: 258px;" />
<pre>
<strong>Input:</strong> root = [1,2,2,null,3,null,3]
<strong>Output:</strong> false
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li>The number of nodes in the tree is in the range <code>[1, 1000]</code>.</li>
	<li><code>-100 &lt;= Node.val &lt;= 100</code></li>
</ul>

<p>&nbsp;</p>
<strong>Follow up:</strong> Could you solve it both recursively and iteratively?
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
//SOLUTION USING QUEUE AND THIS SOLUTION SOO TRUMENDUS 
bool ismirror(TreeNode* root1,TreeNode* root2){
    if(root1==NULL && root2==NULL){
        return true;
    }
    if (root1 && root2 && root1->val == root2->val)
        return ismirror(root1->left, root2->right)
               && ismirror(root1->right, root2->left);

    // if none of above conditions is true then root1
    // and root2 are not mirror images
    return false; 
}

bool check(TreeNode* root){
    return ismirror(root,root);
}
    bool isSymmetric(TreeNode* root) {

        return check(root);
    // if(root == NULL) return true; // An empty tree is symmetric
    //     queue<TreeNode*> q;
    //     q.push(root->left);
    //     q.push(root->right);
    //     while (!q.empty()){
    //         TreeNode* left = q.front(); q.pop();
    //         TreeNode* right = q.front(); q.pop();
    //         if(left == NULL  && right == NULL) continue; // Both are NULL, symmetric at this level
    //         if(left ==NULL  or  right==NULL) return false; // One is NULL and the other is not, not symmetric
    //         if(left->val != right->val) return false; // Values differ, not symmetric
    //         // Enqueue children in the order to compare them as mirror images
    //         q.push(left->left);
    //         q.push(right->right);
    //         q.push(left->right);
    //         q.push(right->left);
    //     }
    //     return true; // tree is symmetric
    }
};
17300