Skip to content

Binary Tree Maximum Path Sum#143

Open
tom4649 wants to merge 2 commits into
mainfrom
124.Binary-Tree-Maximum-Path-Sum
Open

Binary Tree Maximum Path Sum#143
tom4649 wants to merge 2 commits into
mainfrom
124.Binary-Tree-Maximum-Path-Sum

Conversation

@tom4649

@tom4649 tom4649 commented Jun 29, 2026

Copy link
Copy Markdown
Owner

max_sum_left = update_max_sum(node.left)
max_sum_right = update_max_sum(node.right)
max_sum_self = node.val + max(0, max_sum_left, max_sum_right)
max_sum = max(max_sum, max_sum_self, node.val + max_sum_left+max_sum_right)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

こちらのコメントをご参照ください。
mt2324/leetcode#2 (comment)

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