Skip to content

Commit c98a822

Browse files
authored
docs: update description to lcci problem No.02.04 (#734)
No.02.04.Partition List
1 parent b9b0973 commit c98a822

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lcci/02.04.Partition List/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,18 @@
4242

4343
<!-- 这里可写通用的实现逻辑 -->
4444

45+
**方法 1:**
46+
4547
创建两个链表,一个存放小于 `x` 的节点,另一个存放大于等于 `x` 的节点,之后进行拼接即可。
4648

49+
**方法 2:**
50+
51+
题中指出,**不需要保留节点的相对位置**
52+
53+
1. 遍历链表。
54+
2. 当节点符合小于 `x` 条件时,将其移动至头节点前方,成为新的头节点。
55+
3. 忽略大于等于 `x` 的节点。
56+
4757
<!-- tabs:start -->
4858

4959
### **Python3**

0 commit comments

Comments
 (0)