Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a618066

Browse files
authoredNov 22, 2021
Create Readme.md
1 parent 3d35058 commit a618066

File tree

1 file changed

+5
-0
lines changed
  • Linked_List/2046.Sort-Linked-List-Already-Sorted-Using-Absolute-Values

1 file changed

+5
-0
lines changed
 
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### 2046.Sort-Linked-List-Already-Sorted-Using-Absolute-Values
2+
3+
本题的突破点在于,我们可以发现所有的正数都是从小到大排列的,所有的负数也是从大到小排列的。我们把所有的正数、负数节点分别拿出来组成两个链表,显然只需要把负数链表反转再接上正数链表就是答案了。
4+
5+
这种“按照绝对值升序排列”的序列有很多有意思的题目。比如说,在这样的一个数组里,能否用o(N)的时间判断是否存在two sum等于target。

0 commit comments

Comments
 (0)
Please sign in to comment.