86. Partition List
Difficulty: Medium
Given a linked list and a value _x_, partition it such that all nodes less than _x_ come before nodes greater than or equal to _x_.
You should preserve the original relative order of the nodes in each of the two partitions.
For example,
Given 1->4->3->2->5->2 and _x_ = 3,
return 1->2->2->4->3->5.
Solution
用两个链表分别存储,最后合并
1 | /** |