```
bool isSymmetric(TreeNode* root) {
if (!root) return true;
return dfs_sym(root->left, root->right);
}
bool dfs_sym(TreeNode *left, TreeNode *right) {
if (!left || !right) return left == right;
return left->val == right->val && dfs_sym(left->left, right->right) && dfs_sym(left->right, right->left);
}
```