Skip to content

Create 98. Validate Binary Search Tree.md#8

Merged
Mike0121 merged 3 commits intomainfrom
98.-Validate-Binary-Search-Tree.md
Nov 1, 2025
Merged

Create 98. Validate Binary Search Tree.md#8
Mike0121 merged 3 commits intomainfrom
98.-Validate-Binary-Search-Tree.md

Conversation

@Mike0121
Copy link
Copy Markdown
Owner

@Mike0121 Mike0121 commented May 3, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

このタイミングで弾いても良いですが、自分ならnode_stackに追加するタイミングでNoneなら追加しないなーと思います。

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.

そうですね、ノードを確認する量が1層分減りますね。この書き方であれば、
if not root: return Trueを削除しても動くと思ったですが、消し忘れてますね。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

本当にstackですか?

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.

ありがとうございます。ご指摘の通り、こちらqueueですね。
また、node_stackよりは、nodes_and_boundsとかの方が良いかと思いました。

Comment on lines 27 to 28
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

この条件は次checking_node.rightがpopされたときに判定されるので不要だと思いました。

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.

ありがとうございます。確かにそうですね。

@Mike0121 Mike0121 changed the title 98. Validate Binary Search Tree.md Create 98. Validate Binary Search Tree.md Nov 1, 2025
@Mike0121 Mike0121 merged commit b1562f5 into main Nov 1, 2025
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.

4 participants