Skip to content

Commit f7136a1

Browse files
committed
Runtime: 1 ms (Top 64.02%) | Memory: 42.7 MB (Top 25.40%)
1 parent 5176b51 commit f7136a1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
// Runtime: 1 ms (Top 64.02%) | Memory: 42.7 MB (Top 25.40%)
12
class Solution {
23
public boolean isSymmetric(TreeNode root) {
34
return isSymmetric(root.left,root.right);
45
}
5-
6+
67
public boolean isSymmetric(TreeNode rootLeft, TreeNode rootRight) {
78
if(rootLeft == null && rootRight == null) {return true;}
89
if(rootLeft == null || rootRight == null) {return false;}
910
if (rootLeft.val != rootRight.val) {return false;}
1011
else
1112
return isSymmetric(rootLeft.right, rootRight.left) && isSymmetric(rootLeft.left, rootRight.right);
1213
}
13-
}
14+
}

0 commit comments

Comments
 (0)