We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 2eb6e15 + e5c550d commit 7bc0dc7Copy full SHA for 7bc0dc7
solution/0100.Same Tree/Solution.java
@@ -0,0 +1,7 @@
1
+class Solution {
2
+ public boolean isSameTree(TreeNode p, TreeNode q) {
3
+ if (p==null && q==null) return true;
4
+ if (p==null || q==null || p.val!=q.val) return false;
5
+ return isSameTree(p.left,q.left) && isSameTree(p.right,q.right);
6
+ }
7
+}
0 commit comments