86 Partition List
86. Partition List
1. Question
Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.
You should preserve the original relative order of the nodes in each of the two partitions.
For example,
Given1->4->3->2->5->2
andx= 3,
return1->2->2->4->3->5
.
2. Implementation
3. Time & Space Complexity
时间复杂度O(n), 空间复杂度O(1)
Last updated