sharing my recursive one

class Solution { public: bool isSymmetric(TreeNode* root) { if(!root) return true; return symmetric(root->left,root->right); } private: bool symmetric(TreeNode* left,TreeNode* right) { if(left==NULL || right==NULL) return left==right; if(left->val==right->val) return symmetric(left->left,right->right) && symmetric(left->right,right->left); return false; } };