Skip to content

Commit 25350ec

Browse files
author
lihangqi
committed
修改为 Python3 模板
1 parent e04cfb8 commit 25350ec

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lcci/04.10.Check SubTree/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@
3636

3737
```python
3838
class Solution:
39-
def checkSubTree(self,t1,t2):
39+
def checkSubTree(self, t1: TreeNode, t2: TreeNode) -> bool:
4040
if t1 == None:
4141
return False
4242
if t2 == None:
4343
return True
4444
return self.dfs(t1,t2) or self.checkSubTree(t1.left,t2) or self.checkSubTree(t1.right,t2)
4545

46-
def dfs(self,t1,t2):
46+
def dfs(self, t1: TreeNode, t2: TreeNode) -> bool:
4747
if not t1 and t2 :
4848
return False
4949
if not t2 and not t1:

lcci/04.10.Check SubTree/README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ Find the t2 node in t1 first, then use the depth-first search (DFS) algorithm to
5757

5858
```python
5959
class Solution:
60-
def checkSubTree(self,t1,t2):
60+
def checkSubTree(self, t1: TreeNode, t2: TreeNode) -> bool:
6161
if t1 == None:
6262
return False
6363
if t2 == None:
6464
return True
6565
return self.dfs(t1,t2) or self.checkSubTree(t1.left,t2) or self.checkSubTree(t1.right,t2)
6666

67-
def dfs(self,t1,t2):
67+
def dfs(self, t1: TreeNode, t2: TreeNode) -> bool:
6868
if not t1 and t2 :
6969
return False
7070
if not t2 and not t1:

lcci/04.10.Check SubTree/Solution.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
class Solution:
2-
def checkSubTree(self,t1,t2):
2+
def checkSubTree(self, t1: TreeNode, t2: TreeNode) -> bool:
33
if t1 == None:
44
return False
55
if t2 == None:
66
return True
77
return self.dfs(t1,t2) or self.checkSubTree(t1.left,t2) or self.checkSubTree(t1.right,t2)
88

9-
def dfs(self,t1,t2):
9+
def dfs(self, t1: TreeNode, t2: TreeNode) -> bool:
1010
if not t1 and t2 :
1111
return False
1212
if not t2 and not t1:

0 commit comments

Comments
 (0)