diff --git a/problems/0024.两两交换链表中的节点.md b/problems/0024.两两交换链表中的节点.md index 57034f47..405f4183 100644 --- a/problems/0024.两两交换链表中的节点.md +++ b/problems/0024.两两交换链表中的节点.md @@ -63,7 +63,9 @@ public: cur = cur->next->next; // cur移动两位,准备下一轮交换 } - return dummyHead->next; + ListNode* result = dummyHead->next; + delete dummyHead; + return result; } }; ```