[ ITERATIVE (BFS) ] 0 ms beats 100% cpp submissions.
Intuition\nChecking Tree\'s symmetry comparing values of same level nodes in left and right subtrees.\n\n# Approach\nPerform Breadth-first search using queue da
# Intuition\nChecking Tree\'s symmetry comparing values of same level nodes in left and right subtrees.\n\n# Approach\nPerform **Breadth-first search** using queue data structure to do a level order traversal of the tree comparing values of corresponding level nodes in left and right subtrees thus know whether symmetric or not. Pushing two copies of each node into the queue so the comparison of nodes that are non-direct children of each other is feasible. For instance, nodes seperated by null values.\n\n# Complexity\n- Time complexity:\nWorst case : O(N) where N is the number of nodes in the tree.\n\n- Space complexity:\nO(W) where W is the maximum width of the tree.\n# Code\n```\nclass Solution {\npublic:\n    bool isSymmetric(TreeNode* root) {\n    if(!root) return 1;\n    queue<TreeNode*> q;\n    q.push(root), q.push(root);\n    while(!q.empty()) {\n        TreeNode* n(q.front());\n        q.pop();\n        TreeNode* n2(q.front());\n        q.pop();\n        if(n==nullptr and n2==nullptr) continue;\n        if(n==nullptr or n2==nullptr or n->val!=n2->val) return 0;\n        q.push(n->left), q.push(n2->right), q.push(n->right), q.push(n2->left);\n    }\n    return 1;\n    }\n};\n```
['Breadth-First Search', 'Binary Tree', 'C++']