GoalScope — max_path_sum (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
↵
<code>↵
def max_path_sum(root):↵
"""Helper function to calculate the maximum path sum."""↵
def helper(node):↵
if not node:↵
return 0↵
left = max(helper(node.left), 0)↵
right = max(helper(node.right), 0)↵
nonlocal max_sum↵
max_sum = max(max_sum, left + right + node.val)↵
return max(left, right) + node.val↵
↵
max_sum = float('-inf')↵
helper(root)↵
return max_sum↵
</code>