We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 370de5d commit ff9f1d6Copy full SHA for ff9f1d6
100_Same Tree.py
@@ -0,0 +1,20 @@
1
+# Definition for a binary tree node.
2
+# class TreeNode:
3
+# def __init__(self, x):
4
+# self.val = x
5
+# self.left = None
6
+# self.right = None
7
+
8
+class Solution:
9
+ def isSameTree(self, p, q):
10
+ """
11
+ :type p: TreeNode
12
+ :type q: TreeNode
13
+ :rtype: bool
14
15
+ if p == None and q == None:
16
+ return True
17
+ elif p and q and p.val == q.val:
18
+ return self.isSameTree(p.left, q.left) and self.isSameTree(p.right, q.right)
19
+ return False
20
0 commit comments