mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
44 lines
1009 B
HTML
44 lines
1009 B
HTML
|
<p>给定一个头节点为 <code>head</code> 的单链表用于记录一系列核心肌群训练编号,请将该系列训练编号 <strong>倒序</strong> 记录于链表并返回。</p>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>示例 1:</strong></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<strong>输入:</strong>head = [1,2,3,4,5]
|
|||
|
<strong>输出:</strong>[5,4,3,2,1]
|
|||
|
</pre>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>示例 2:</strong></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<strong>输入:</strong>head = [1,2]
|
|||
|
<strong>输出:</strong>[2,1]
|
|||
|
</pre>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>示例 3:</strong></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<strong>输入:</strong>head = []
|
|||
|
<strong>输出:</strong>[]
|
|||
|
</pre>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>提示:</strong></p>
|
|||
|
|
|||
|
<ul>
|
|||
|
<li>链表中节点的数目范围是 <code>[0, 5000]</code></li>
|
|||
|
<li><code>-5000 <= Node.val <= 5000</code></li>
|
|||
|
</ul>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>注意</strong>:本题与主站 206 题相同:<a href="https://leetcode-cn.com/problems/reverse-linked-list/">https://leetcode-cn.com/problems/reverse-linked-list/</a></p>
|
|||
|
|
|||
|
<p> </p>
|