Slim Java solution
The idea is:\n1. level traversal.\n2. push nodes onto stack, every 2 consecutive is a pair, and should either be both null or have equal value.\nrepeat until st
The idea is:\n1. level traversal.\n2. push nodes onto stack, every 2 consecutive is a pair, and should either be both null or have equal value.\nrepeat until stack is empty.\n\n    public boolean isSymmetric(TreeNode root) {\n        if (root == null)\n            return true;\n        Stack<TreeNode> stack = new Stack<TreeNode>();\n        stack.push(root.left);\n        stack.push(root.right);\n        while (!stack.isEmpty()) {\n            TreeNode node1 = stack.pop();\n            TreeNode node2 = stack.pop();\n            if (node1 == null && node2 == null)\n                continue;\n            if (node1 == null || node2 == null)\n                return false;\n            if (node1.val != node2.val)\n                return false;\n            stack.push(node1.left);\n            stack.push(node2.right);\n            stack.push(node1.right);\n            stack.push(node2.left);\n        }\n        return true;\n    }
[]