python | iterative | recursive
recursive\n\n\tclass Solution:\n\t\tdef isSymmetric(self, root):\n\t\t\tif not root:\n\t\t\t\treturn False\n\t\t\tdef helper(l, r):\n\t\t\t\tif not l and not r:
recursive\n\n\tclass Solution:\n\t\tdef isSymmetric(self, root):\n\t\t\tif not root:\n\t\t\t\treturn False\n\t\t\tdef helper(l, r):\n\t\t\t\tif not l and not r:\n\t\t\t\t\treturn True\n\t\t\t\tif l and r and l.val == r.val:\n\t\t\t\t\treturn helper(l.left, r.right) and helper(l.right, r.left)\n\n\t\t\treturn helper(root, root)\n\t\t\t\niterative\n\n\tclass Solution:\n\t\tdef isSymmetric(self, root):\n\t\t\tqueue = [(root, root)]\n\t\t\twhile queue:\n\t\t\t\tl, r = queue.pop(0)\n\t\t\t\tif l is None and r is None:\n\t\t\t\t\tcontinue\n\n\t\t\t\tif l is None or r is None:\n\t\t\t\t\treturn False\n\t\t\t\tif l.val == r.val:\n\t\t\t\t\tqueue.append((l.left, r.right))\n\t\t\t\t\tqueue.append((l.right, r.left))\n\t\t\t\telse:\n\t\t\t\t\treturn False\n\t\t\treturn True
['Recursion', 'Iterator', 'Python', 'Python3']