Skip to content

Commit b9b0973

Browse files
authored
docs: update description to lcci problem No.02.04 (#733)
* docs: update description to lcci problem No.02.04 * docs: add image asset * docs: update images path
1 parent e85418a commit b9b0973

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

lcci/02.04.Partition List/README.md

+29-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,39 @@
55
## 题目描述
66

77
<!-- 这里写题目描述 -->
8-
<p>编写程序以 x 为基准分割链表,使得所有小于 x 的节点排在大于或等于 x 的节点之前。如果链表中包含 x,x 只需出现在小于 x 的元素之后(如下所示)。分割元素 x 只需处于&ldquo;右半部分&rdquo;即可,其不需要被置于左右两部分之间。</p>
98

10-
<p><strong>示例:</strong></p>
9+
<p>给你一个链表的头节点 <code>head</code> 和一个特定值<em> </em><code>x</code> ,请你对链表进行分隔,使得所有 <strong>小于</strong> <code>x</code> 的节点都出现在 <strong>大于或等于</strong> <code>x</code> 的节点之前。</p>
1110

12-
<pre><strong>输入:</strong> head = 3-&gt;5-&gt;8-&gt;5-&gt;10-&gt;2-&gt;1, <em>x</em> = 5
13-
<strong>输出:</strong> 3-&gt;1-&gt;2-&gt;10-&gt;5-&gt;5-&gt;8
11+
<p>你不需要&nbsp;<strong>保留</strong>&nbsp;每个分区中各节点的初始相对位置。</p>
12+
13+
<p>&nbsp;</p>
14+
15+
<p><strong>示例 1:</strong></p>
16+
17+
<img alt="" src="https://cdn.jsdelivr.net/gh/doocs/leetcode@main/lcci/02.04.Partition%20List/images/partition.jpg" style="width: 662px; height: 222px;" />
18+
19+
<pre>
20+
<strong>输入:</strong>head = [1,4,3,2,5,2], x = 3
21+
<strong>输出</strong>:[1,2,2,4,3,5]
22+
</pre>
23+
24+
<p><strong>示例 2:</strong></p>
25+
26+
<pre>
27+
<strong>输入:</strong>head = [2,1], x = 2
28+
<strong>输出</strong>:[1,2]
1429
</pre>
1530

31+
<p>&nbsp;</p>
32+
33+
<p><strong>提示:</strong></p>
34+
35+
<ul>
36+
<li>链表中节点的数目在范围 <code>[0, 200]</code> 内</li>
37+
<li><code>-100 &lt;= Node.val &lt;= 100</code></li>
38+
<li><code>-200 &lt;= x &lt;= 200</code></li>
39+
</ul>
40+
1641
## 解法
1742

1843
<!-- 这里可写通用的实现逻辑 -->
23.2 KB
Loading

0 commit comments

Comments
 (0)