Skip to content

Commit a58ebaa

Browse files
python: add problem 100 and unittest
1 parent d8aabde commit a58ebaa

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

‎Python/sln_1_100/solution_91_100.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
from typing import List
3-
from common_utils import ListNode
3+
from common_utils import ListNode, TreeNode
44

55

66
class Solution_91_100(object):
@@ -107,3 +107,19 @@ def resolve_ip(segments, rest_s, last_num):
107107
resolve_ip([], s, None)
108108

109109
return results
110+
111+
def isSameTree(self, p: TreeNode, q: TreeNode) -> bool:
112+
"""
113+
100
114+
:param p:
115+
:param q:
116+
:return:
117+
"""
118+
119+
if p and q and p.val == q.val:
120+
is_left = self.isSameTree(p.left, q.left)
121+
is_right = self.isSameTree(p.right, q.right)
122+
return is_left and is_right
123+
if not p and not q:
124+
return True
125+
return False

0 commit comments

Comments
 (0)