From f5fae6e5c2463acdfcc87bd1fe97df18d2cf3f27 Mon Sep 17 00:00:00 2001 From: CyC2018 Date: Wed, 28 Oct 2026 13:45:04 +0800 Subject: [PATCH] =?UTF-8?q?Update=2024.=20=E5=8F=8D=E8=BD=AC=E9=93=BE?= =?UTF-8?q?=E8=A1=A8.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 题目链接改为力扣中的对应题目,题目描述和代码按该题的接口调整。 --- notes/24. 反转链表.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/notes/24. 反转链表.md b/notes/24. 反转链表.md index 05bc439f..7db8fc88 100644 --- a/notes/24. 反转链表.md +++ b/notes/24. 反转链表.md @@ -1,18 +1,18 @@ # 24. 反转链表 -[NowCoder](https://www.nowcoder.com/practice/75e878df47f24fdc9dc3e400ec6058ca?tpId=13&tqId=11168&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github) +[Leetcode](https://leetcode.cn/problems/fan-zhuan-lian-biao-lcof/) ## 解题思路 ### 递归 ```java -public ListNode ReverseList(ListNode head) { +public ListNode trainningPlan(ListNode head) { if (head == null || head.next == null) return head; ListNode next = head.next; head.next = null; - ListNode newHead = ReverseList(next); + ListNode newHead = trainningPlan(next); next.next = head; return newHead; } @@ -23,7 +23,7 @@ public ListNode ReverseList(ListNode head) { 使用头插法。 ```java -public ListNode ReverseList(ListNode head) { +public ListNode trainningPlan(ListNode head) { ListNode newList = new ListNode(-1); while (head != null) { ListNode next = head.next;