Clean iterative solution in C++
/**\n     * Definition for a binary tree node.\n     * struct TreeNode {\n     *     int val;\n     *     TreeNode *left;\n     *     TreeNode *right;\n     *  
    /**\n     * Definition for a binary tree node.\n     * struct TreeNode {\n     *     int val;\n     *     TreeNode *left;\n     *     TreeNode *right;\n     *     TreeNode(int x) : val(x), left(NULL), right(NULL) {}\n     * };\n     */\n    class Solution {\n    public:\n        bool isSymmetric(TreeNode* root) {\n            if(!root) return true;\n            stack<TreeNode*> sk;\n            sk.push(root->left);\n            sk.push(root->right);\n            \n            TreeNode* pA, *pB;\n            while(!sk.empty()) {\n                pA = sk.top();\n                sk.pop();\n                pB = sk.top();\n                sk.pop();\n                \n                if(!pA && !pB) continue;\n                if(!pA || !pB) return false;\n                if(pA->val != pB->val) return false;\n                \n                sk.push(pA->left);\n                sk.push(pB->right);\n                sk.push(pA->right);\n                sk.push(pB->left);\n            }\n            \n            return true;\n        }\n    };
[]