We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bc78ade commit b28b710Copy full SHA for b28b710
2018.12.4-leetcode101/zjukk.md
@@ -0,0 +1,15 @@
1
+```
2
+class Solution {
3
+public:
4
+ bool isSymmetric(TreeNode* root) {
5
+ if (!root) return true;
6
+ return help(root->left,root->right);
7
+ }
8
+ bool help(TreeNode* left, TreeNode* right) {
9
+ if (!left && !right) return true;
10
+ if ((!left && right) || (left && !right)) return false;
11
+ if (left->val != right->val) return false;
12
+ else return help(left->left,right->right) && help(left->right,right->left);
13
14
+};
15
0 commit comments