0 ms100% Iteration && Recursion
Iteration\n\ngolang\nfunc isSymmetric(root *TreeNode) bool {\n    if root == nil {\n\t\treturn true\n\t}\n\tvar stack []*TreeNode\n\tstack = append(stack, root.
#### Iteration\n\n```golang\nfunc isSymmetric(root *TreeNode) bool {\n    if root == nil {\n\t\treturn true\n\t}\n\tvar stack []*TreeNode\n\tstack = append(stack, root.Left, root.Right)\n\tfor len(stack) > 0 {\n\t\tl, r := stack[0], stack[1]\n\t\tstack = stack[2:]\n\t\tif l == nil && r == nil {\n\t\t\tcontinue\n\t\t} else if (l == nil && r != nil) || l != nil && r == nil {\n\t\t\treturn false\n\t\t} else if l.Val != r.Val {\n\t\t\treturn false\n\t\t}\n\t\tstack = append(stack, l.Left, r.Right, l.Right, r.Left)\n\t}\n\treturn true\n}\n```\n\n#### Recursion\n\n```golang\nfunc isSymmetric(root *TreeNode) bool {\n\tif root == nil {\n\t\treturn true\n\t}\n\treturn helper(root.Left, root.Right)\n}\n\nfunc helper(left *TreeNode, right *TreeNode) bool {\n\tif left == nil || right == nil {\n\t\treturn left == right\n\t}\n\tif left.Val != right.Val {\n\t\treturn false\n\t}\n\treturn helper(left.Left, right.Right) && helper(left.Right, right.Left)\n}\n```
['Go']