Skip to content

Commit c4edf2d

Browse files
reduce three lines to two lines
1 parent 9023573 commit c4edf2d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

EASY/src/easy/SameTree.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public class SameTree {
1515
//recursion idea flows out naturally.
1616
public boolean isSameTree(TreeNode p, TreeNode q) {
1717
if(p == null || q == null) return p == q;
18-
if(p.val != q.val) return false;
19-
return isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
18+
return p.val == q.val && isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
2019
}
2120
}

0 commit comments

Comments
 (0)