GoalScope — lowest_common_ancestor (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
↵
<code>↵
def lowest_common_ancestor(root, p, q):↵
"""Find the lowest common ancestor of two given nodes in a binary tree."""↵
if not root or root == p or root == q:↵
return root↵
left = lowest_common_ancestor(root.left, p, q)↵
right = lowest_common_ancestor(root.right, p, q)↵
if left and right:↵
return root↵
return left if left else right↵
</code>