Skip to content

112. Path Sum#30

Open
Yuto729 wants to merge 1 commit intomainfrom
past-sum
Open

112. Path Sum#30
Yuto729 wants to merge 1 commit intomainfrom
past-sum

Conversation

@Yuto729
Copy link
Owner

@Yuto729 Yuto729 commented Mar 17, 2026

解く問題

Path Sum

次に解く問題

Binary Tree Level Order Traversal

@Yuto729 Yuto729 changed the title Path Sum 112. Path Sum Mar 17, 2026
Repository owner deleted a comment from github-actions bot Mar 17, 2026
result = []
path = []

def dfs(node, remaining):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

自分が指摘されたミスですが、dfsの関数名だと何も表現できていないので、traverseのような動作を表す関数名が望ましいと思います。

```py
class Solution:
def hasPathSum(self, root: Optional[TreeNode], targetSum: int) -> bool:
if not root:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not root と node is None が混在しているのが気になりました。 is None に統一することをお勧めいたします。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants