mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 06:51:41 +08:00
存量题库数据更新
This commit is contained in:
48
leetcode-cn/problem (Chinese)/排序链表 [7WHec2].html
Normal file
48
leetcode-cn/problem (Chinese)/排序链表 [7WHec2].html
Normal file
@@ -0,0 +1,48 @@
|
||||
<p>给定链表的头结点 <code>head</code> ,请将其按 <strong>升序</strong> 排列并返回 <strong>排序后的链表</strong> 。</p>
|
||||
|
||||
<ul>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<p><img alt="" src="https://assets.leetcode.com/uploads/2020/09/14/sort_list_1.jpg" style="width: 302px; " /></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>head = [4,2,1,3]
|
||||
<b>输出:</b>[1,2,3,4]
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<p><img alt="" src="https://assets.leetcode.com/uploads/2020/09/14/sort_list_2.jpg" style="width: 402px; " /></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>head = [-1,5,3,4,0]
|
||||
<b>输出:</b>[-1,0,3,4,5]
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>head = []
|
||||
<b>输出:</b>[]
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><b>提示:</b></p>
|
||||
|
||||
<ul>
|
||||
<li>链表中节点的数目在范围 <code>[0, 5 * 10<sup>4</sup>]</code> 内</li>
|
||||
<li><code>-10<sup>5</sup> <= Node.val <= 10<sup>5</sup></code></li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><b>进阶:</b>你可以在 <code>O(n log n)</code> 时间复杂度和常数级空间复杂度下,对链表进行排序吗?</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><meta charset="UTF-8" />注意:本题与主站 148 题相同:<a href="https://leetcode-cn.com/problems/sort-list/">https://leetcode-cn.com/problems/sort-list/</a></p>
|
Reference in New Issue
Block a user