Skip to content

Commit 4f34eb8

Browse files
committed
ci: fix ci
1 parent edb071c commit 4f34eb8

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

leetcode/subtree_of_another_tree/solution.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33

44
class Solution:
55

6-
# Time: O(m * n) - where m is nodes in root, n is nodes in subRoot
6+
# Time: O(m * n) - where m is nodes in root, n is nodes in sub_root
77
# Space: O(h) - where h is height of root tree (recursion stack)
8-
def is_subtree(self, root: TreeNode[int] | None, subRoot: TreeNode[int] | None) -> bool:
8+
def is_subtree(self, root: TreeNode[int] | None, sub_root: TreeNode[int] | None) -> bool:
99
"""
10-
Check if subRoot is a subtree of root.
10+
Check if sub_root is a subtree of root.
1111
Uses DFS to check every node in root as potential subtree root.
1212
"""
13-
if not subRoot:
13+
if not sub_root:
1414
return True
1515
if not root:
1616
return False
1717

18-
# Check if current root matches subRoot
19-
if self._is_same_tree(root, subRoot):
18+
# Check if current root matches sub_root
19+
if self._is_same_tree(root, sub_root):
2020
return True
2121

2222
# Recursively check left and right subtrees
23-
return self.is_subtree(root.left, subRoot) or self.is_subtree(root.right, subRoot)
23+
return self.is_subtree(root.left, sub_root) or self.is_subtree(root.right, sub_root)
2424

2525
def _is_same_tree(self, p: TreeNode[int] | None, q: TreeNode[int] | None) -> bool:
2626
"""Helper method to check if two trees are identical."""

leetcode_py/cli/resources/leetcode/json/problems/subtree_of_another_tree.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"list": [
4141
{
4242
"name": "is_subtree",
43-
"signature": "(self, root: TreeNode[int] | None, subRoot: TreeNode[int] | None) -> bool",
43+
"signature": "(self, root: TreeNode[int] | None, sub_root: TreeNode[int] | None) -> bool",
4444
"body": " # TODO: Implement is_subtree\n return False"
4545
}
4646
]

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ select = [
8989
"W", # pycodestyle warnings
9090
"F", # pyflakes
9191
"I", # isort
92-
"N802", # pep8-naming
92+
"N", # pep8-naming
9393
]
94+
ignore = ["N806"]
9495

9596
[tool.ruff.lint.pydocstyle]
9697
convention = "numpy"

0 commit comments

Comments
 (0)