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 b93eb38 commit 1bab0c4Copy full SHA for 1bab0c4
same-tree/printjin-gmailcom.py
@@ -0,0 +1,9 @@
1
+class Solution:
2
+ def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool:
3
+ if not p and not q:
4
+ return True
5
+ if not p or not q:
6
+ return False
7
+ if p.val != q.val:
8
9
+ return self.isSameTree(p.left, q.left) and self.isSameTree(p.right, q.right)
0 commit comments