Recursive and non-recursive solutions in Java
Recursive--400ms:\n\n    public boolean isSymmetric(TreeNode root) {\n        return root==null || isSymmetricHelp(root.left, root.right);\n    }\n    \n    pri
Recursive--400ms:\n\n    public boolean isSymmetric(TreeNode root) {\n        return root==null || isSymmetricHelp(root.left, root.right);\n    }\n    \n    private boolean isSymmetricHelp(TreeNode left, TreeNode right){\n        if(left==null || right==null)\n            return left==right;\n        if(left.val!=right.val)\n            return false;\n        return isSymmetricHelp(left.left, right.right) && isSymmetricHelp(left.right, right.left);\n    }\n\nNon-recursive(use Stack)--460ms:\n\n    public boolean isSymmetric(TreeNode root) {\n        if(root==null)  return true;\n        \n        Stack<TreeNode> stack = new Stack<TreeNode>();\n        TreeNode left, right;\n        if(root.left!=null){\n            if(root.right==null) return false;\n            stack.push(root.left);\n            stack.push(root.right);\n        }\n        else if(root.right!=null){\n            return false;\n        }\n            \n        while(!stack.empty()){\n            if(stack.size()%2!=0)   return false;\n            right = stack.pop();\n            left = stack.pop();\n            if(right.val!=left.val) return false;\n            \n            if(left.left!=null){\n                if(right.right==null)   return false;\n                stack.push(left.left);\n                stack.push(right.right);\n            }\n            else if(right.right!=null){\n                return false;\n            }\n                \n            if(left.right!=null){\n                if(right.left==null)   return false;\n                stack.push(left.right);\n                stack.push(right.left);\n            }\n            else if(right.left!=null){\n                return false;\n            }\n        }\n        \n        return true;\n    }
['Stack', 'Recursion', 'Java']