Skip to content

Commit b3d865b

Browse files
authored
Merge pull request #976 from spshinde105/spshinde105-patch-2
Added Solution for LeetCode Problem No. 100
2 parents 6b05c6f + 905a123 commit b3d865b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

LeetCode/100. Same Tree/Solution.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public boolean isSameTree(TreeNode p, TreeNode q) {
3+
if(p == null && q==null){
4+
return true;
5+
}
6+
if(p==null || q==null){
7+
return false;
8+
}
9+
return p.val == q.val && isSameTree(p.left,q.left) && isSameTree(p.right,q.right);
10+
}
11+
}

0 commit comments

Comments
 (0)