Skip to content

104. Maximum Depth of Binary Tree#19

Open
tom4649 wants to merge 1 commit intomainfrom
104.Maximum-Depth-of-BinaryTree
Open

104. Maximum Depth of Binary Tree#19
tom4649 wants to merge 1 commit intomainfrom
104.Maximum-Depth-of-BinaryTree

Conversation

@tom4649
Copy link
Copy Markdown
Owner

@tom4649 tom4649 commented Mar 15, 2026

Copy link
Copy Markdown

@dxxsxsxkx dxxsxsxkx left a comment

Choose a reason for hiding this comment

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

良いと思いました。

@@ -0,0 +1,22 @@
# 104. Maximum Depth of Binary Tree

[リンク](https://leetcode.com/problems/maximum-depth-of-binary-tree/description/)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

もしなさっていなかったら、計算量と時間の見積もりをしてみるのも良いかもしれません。

def dfs(node, depth):
if node is None:
return depth
depth_l = depth_r = 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

自分なら left_depth right_depth と名付けるのですが、趣味の範囲かもしれません。

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

その方が良いと思います。
可読性高く、省略しないで変数名を書くことを意識しようと思います。

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