Skip to content

Balanced Binary Tree - #82

Open
Yuto729 wants to merge 1 commit into
mainfrom
balanced-binary-tree
Open

Balanced Binary Tree#82
Yuto729 wants to merge 1 commit into
mainfrom
balanced-binary-tree

Conversation

@Yuto729

@Yuto729 Yuto729 commented Jun 24, 2026

Copy link
Copy Markdown
Owner

解く問題

Balanced Binary Tree

次に解く問題

@github-actions

Copy link
Copy Markdown

お疲れ様です。

Balanced Binary Treeに取り組みました。
お手隙の際にレビューをお願いいたします。

問題: https://leetcode.com/problems/balanced-binary-tree/
PR: #82
言語: Python3

node = root
last_visited = None
node_to_depth = {}
while stack or node:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nodenode is not None が混ざっているのが気になりました。 node is not None に統一するとよいと思います。

# 行けるだけ左に潜る
stack.append(node)
node = node.left
else:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

continue してネストを下げたほうが読みやすくなると思いました。

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.

2 participants