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 ddb3748 commit 76d1b49Copy full SHA for 76d1b49
src/main/java/com/fishercoder/solutions/_101.java
@@ -2,7 +2,8 @@
2
3
import com.fishercoder.common.classes.TreeNode;
4
5
-/**101. Symmetric Tree
+/**
6
+ * 101. Symmetric Tree
7
8
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
9
@@ -39,10 +40,7 @@ private boolean isSymmetric(TreeNode left, TreeNode right) {
39
40
if (left == null || right == null) {
41
return left == right;
42
}
- if (left.val != right.val) {
43
- return false;
44
- }
45
- return isSymmetric(left.left, right.right) && isSymmetric(left.right, right.left);
+ return left.val == right.val && isSymmetric(left.left, right.right) && isSymmetric(left.right, right.left);
46
47
48
0 commit comments