Skip to content

Lowest Common Ancestor Of A Binary Search Tree#75

Open
Yuto729 wants to merge 2 commits into
mainfrom
lowest-common-ancestor-of-a-binary-search-tree
Open

Lowest Common Ancestor Of A Binary Search Tree#75
Yuto729 wants to merge 2 commits into
mainfrom
lowest-common-ancestor-of-a-binary-search-tree

Conversation

@Yuto729

@Yuto729 Yuto729 commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Repository owner deleted a comment from github-actions Bot Jun 4, 2026

found_p_left, found_q_left = dfs(node.left)
found_p_right, found_q_right = dfs(node.right)
found_p = found_p_left or found_p_right or node == p

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

==よりもisを使った方が良さそうです。TreeNodeの__eq__がnode.valで見る実装が存在しても不思議ではなので

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.

2 participants