From dab89905adaac01f541ecb71f2a9e30980c88249 Mon Sep 17 00:00:00 2001 From: Evan Yang Date: Sun, 3 Oct 2021 19:21:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=200206.=E7=BF=BB=E8=BD=AC?= =?UTF-8?q?=E9=93=BE=E8=A1=A8.md=20=E6=B7=BB=E5=8A=A0=E9=80=92=E5=BD=92?= =?UTF-8?q?=E8=A7=A3=E6=B3=95=E6=80=9D=E8=B7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0206.翻转链表.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/problems/0206.翻转链表.md b/problems/0206.翻转链表.md index 4e450a1b..0c35f7d7 100644 --- a/problems/0206.翻转链表.md +++ b/problems/0206.翻转链表.md @@ -104,8 +104,10 @@ public: class Solution { public: ListNode* reverseList(ListNode* head) { - // 如果链表只有一个节点,返回自身 + // 边缘条件判断 + if(head == NULL) return NULL; if (head->next == NULL) return head; + // 递归调用,翻转第二个节点开始往后的链表 ListNode *last = reverseList(head->next); // 翻转头节点与第二个节点的指向