Skip to content

98. Validate Binary Search Tree - #29

Open
hiroki-horiguchi-dev wants to merge 4 commits into
mainfrom
tree-bst-98
Open

98. Validate Binary Search Tree#29
hiroki-horiguchi-dev wants to merge 4 commits into
mainfrom
tree-bst-98

Conversation

@hiroki-horiguchi-dev

Copy link
Copy Markdown
Owner

98. Validate Binary Search Treeを解きました。

@hiroki-horiguchi-dev hiroki-horiguchi-dev self-assigned this Jul 4, 2026
Comment thread tree-bst/98.md
long min = nodeWithRange.min;
long max = nodeWithRange.max;

if (node.val <= min || node.val >= max) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

数直線上に一直線に並べるように書くと、読み手にとって読みやすくなると思います。

if (!(min < node.val && node.val < max)) {

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.

ありがとうございます。
! の使用を避けて書きましたが、A && B の否定であればわかりやすいですね。

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