GoalScope — reorder_list (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
↵
<code>↵
def reorder_list(head):↵
"""Reorder the linked list in-place."""↵
if not head or not head.next:↵
return↵
↵
Find the middle of the linked list↵
slow = fast = head↵
while fast and fast.next:↵
slow = slow.next↵
fast = fast.next.next↵
↵
Reverse the second half of the list↵
prev, curr = None, slow↵
while curr:↵
next_temp = curr.next↵
curr.next = prev↵
prev = curr↵
curr = next_temp↵
↵
Merge two halves↵
first, second = head, prev↵
while second.next:↵
temp1, temp2 = first.next, second.next↵
first.next = second↵
second.next = temp1↵
first, second = temp1, temp2↵
</code>